Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Levi Morrison
> However, I guess this new feature would slow down the parsing process and > therefore I am against it. It might slow the process down because on every assignment you have to make sure it's not a final variable. Until we really know how much that slows it down, I'm not sure that is much of an iss

AW: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Robert Stoll
. -Ursprüngliche Nachricht- Von: amaury.bouch...@gmail.com [mailto:amaury.bouch...@gmail.com] Im Auftrag von Amaury Bouchard Gesendet: Dienstag, 28. Mai 2013 13:44 An: Sebastian Krebs Cc: Maciek Sokolewicz; Lars Strojny; Ferenc Kovacs; PHP Internals Betreff: Re: [PHP-DEV] supporting the final keyword for

Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Amaury Bouchard
2013/5/28 Sebastian Krebs > > And in your example you have to know, that you are "manipulating" a > variable :? > > Sure. But my example's goal was to show the idea of Lars. Using the "final" keyword on variables would allow to manipulate variables and "constant variables", without the need to kn

Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Sebastian Krebs
2013/5/28 Amaury Bouchard > 2013/5/28 Sebastian Krebs > >>print($$b); >>> >> >> print(constant($b)); >> > > It's definitely different. In your example you have to know that you are > manipulating constants only. > > And in your example you have to know, that you are "manipulating" a variable

Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Ferenc Kovacs
On Tue, May 28, 2013 at 10:58 AM, Lars Strojny wrote: > Hi Ferenc, > > Am 28.05.2013 um 08:15 schrieb Ferenc Kovacs : > [...] > >> I would like it to work the same way as it does in java( > >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.12.4) > >> eg. you can set the initial

Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Amaury Bouchard
2013/5/28 Sebastian Krebs >print($$b); >> > > print(constant($b)); > It's definitely different. In your example you have to know that you are manipulating constants only.

Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Sebastian Krebs
2013/5/28 Amaury Bouchard > 2013/5/28 Maciek Sokolewicz > > > It’s a good idea in general but what about having it for variables as > >> well? Could open interesting possibilities for an optimizer. > >> > >> final $foo = "str"; > >> $foo = "bar"; // bails out > >> > >> Don't we already have tha

Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Amaury Bouchard
2013/5/28 Maciek Sokolewicz > It’s a good idea in general but what about having it for variables as >> well? Could open interesting possibilities for an optimizer. >> >> final $foo = "str"; >> $foo = "bar"; // bails out >> >> Don't we already have that? It just has a different name: constants.

Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Maciek Sokolewicz
On 28-5-2013 10:58, Lars Strojny wrote: Hi Ferenc, Am 28.05.2013 um 08:15 schrieb Ferenc Kovacs : [...] I would like it to work the same way as it does in java( http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.12.4) eg. you can set the initial value either in the declaration or

Re: [PHP-DEV] supporting the final keyword for properties

2013-05-28 Thread Lars Strojny
Hi Ferenc, Am 28.05.2013 um 08:15 schrieb Ferenc Kovacs : [...] >> I would like it to work the same way as it does in java( >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.12.4) >> eg. you can set the initial value either in the declaration or later on, >> but after it is set,

Re: [PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Ferenc Kovacs
On Mon, Jul 16, 2012 at 3:42 PM, Pierre Joye wrote: > hi, > > On Mon, Jul 16, 2012 at 2:25 PM, Ferenc Kovacs wrote: > > > The recent > http://www.mail-archive.com/internals@lists.php.net/msg59301.html > > discussion > > made me wonder why did we decide not supporting the final keywords for > > p

Re: [PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Amaury Bouchard
It could be useful (given the example of Java usage). But still, if the goal is to have read-only attributes, I think my proposal (separate reading and writing visibilities) is more precise and powerful. 2012/7/16 Ferenc Kovacs > Hi, > > The recent > http://www.mail-archive.com/internals@lists.p

Re: [PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Andrew Faulds
In that case, we should use what C# calls it, "readonly". Writable only once by the constructor. On 16 July 2012 14:35, Nikita Popov wrote: > On Mon, Jul 16, 2012 at 2:25 PM, Ferenc Kovacs wrote: >> Hi, >> >> The recent http://www.mail-archive.com/internals@lists.php.net/msg59301.html >> discuss

Re: [PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Pierre Joye
hi, On Mon, Jul 16, 2012 at 2:25 PM, Ferenc Kovacs wrote: > The recent http://www.mail-archive.com/internals@lists.php.net/msg59301.html > discussion > made me wonder why did we decide not supporting the final keywords for > properties as it would provide an easy way for read-only attributes (co

Re: [PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Nikita Popov
On Mon, Jul 16, 2012 at 2:25 PM, Ferenc Kovacs wrote: > Hi, > > The recent http://www.mail-archive.com/internals@lists.php.net/msg59301.html > discussion > made me wonder why did we decide not supporting the final keywords for > properties as it would provide an easy way for read-only attributes (

Re: [PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Ferenc Kovacs
On Mon, Jul 16, 2012 at 2:59 PM, Anthony Ferrara wrote: > Ferenc, > > On Mon, Jul 16, 2012 at 8:25 AM, Ferenc Kovacs wrote: > >> Hi, >> >> The recent >> http://www.mail-archive.com/internals@lists.php.net/msg59301.html >> discussion >> made me wonder why did we decide not supporting the final key

Re: [PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Anthony Ferrara
Ferenc, On Mon, Jul 16, 2012 at 8:25 AM, Ferenc Kovacs wrote: > Hi, > > The recent > http://www.mail-archive.com/internals@lists.php.net/msg59301.html > discussion > made me wonder why did we decide not supporting the final keywords for > properties as it would provide an easy way for read-only

Re: [PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Andrew Faulds
C# does this with the readonly keyword, sounds like a good idea. On 16 July 2012 13:25, Ferenc Kovacs wrote: > Hi, > > The recent http://www.mail-archive.com/internals@lists.php.net/msg59301.html > discussion > made me wonder why did we decide not supporting the final keywords for > properties as

[PHP-DEV] supporting the final keyword for properties

2012-07-16 Thread Ferenc Kovacs
Hi, The recent http://www.mail-archive.com/internals@lists.php.net/msg59301.html discussion made me wonder why did we decide not supporting the final keywords for properties as it would provide an easy way for read-only attributes (const would be a better choice in performance wise, but then you c