On 09/18/2015 01:21 PM, Levi Morrison wrote:
On Fri, Sep 18, 2015 at 11:18 AM, Rowan Collins <rowan.coll...@gmail.com> wrote:
Levi Morrison wrote on 18/09/2015 18:04:

Anything else is trying to add value in some way – in your case you
are adding a primitive value that the language will automatically map
for you. I'm not saying that is a bad thing but I hope you can at
least recognize that it is an addition and not the bare minimum. The
RFC I am planning on proposing will have only the bare minimum because
it's the least controversial part and is the most useful. The other
stuff we can debate about later.


That's why I was kind of surprised to see ordinal() in there in the draft -
it's an additional field on each member, which in many cases has no
relationship to the value being represented.

I suspect it will be removed before hitting the official discussion phase :D

Also, apologies for accidentally starting the discussion of your draft "too
early", I wasn't aware that you were working on it. I was trying to offer
something productive to the language, since I've been spending a lot of time
talking down new features lately. :)

No worries – it happens.


I also believe the rfc should include type hinting of enums as has been mentioned on this discussion. That would make enumerations more useful and the rfc more complete.

enum Weekday {SUNDAY=0, MONDAY=1, TUESDAY=2, WEDNESDAY=3}

function set_day(Weekday $day) : Weekday
{
    // $day can only be numbers 0,1,2,3

    //$return can only also be 0,1,2,3
}

Enums is a really needed feature for PHP that would have make code much more cleaner and easy to follow than what we have today.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to