Re: [RFC][DISCUSSION] Object type hint, now with added variance

From: Date: Wed, 15 Feb 2017 19:53:51 +0000
Subject: Re: [RFC][DISCUSSION] Object type hint, now with added variance
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-98305@lists.php.net to get a copy of this message
In the light of this, maybe enums (assuming this feature comes first) should be implemented as immutable objects rather than values? Type-checking for enums would be important, so in PHP terms, an enum "instance" would likely be closer to an object than a value in nature anyway. The way I look at it, this feature doesn't prevent enums from happening, it just changes the design parameters. Just a thought. On Wed, Feb 15, 2017 at 4:34 PM, Andrea Faulds <ajf@ajf.me> wrote: > Hi Marco, > > Marco Pivetta wrote: > >> >> Since the engine is clueless about types until autoloading happens, this >> is >> easily solvable by providing a marker syntax for non-object hints. For >> instance function foo() : enym:MyEnum {} >> > > If we're going to do prefixes for non-classes, we might as well copy C > outright: enum MyEnum. > > Thanks. > -- > Andrea Faulds > https://ajf.me/ > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#98305) next »