Re: [PHP] Has this always been the case?
[email protected] (Stuart Dallas)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On 31 May 2013, at 12:22, Richard Quadling <[email protected]> wrote: > On 31 May 2013 12:17, shiplu <[email protected]> wrote: > >> On Fri, May 31, 2013 at 5:12 PM, Stuart Dallas <[email protected]> wrote: >>> That is not entirely correct. It must be a literal value. The expression 'a'.'b' is a constant value. >>> I may be being overly picky here, but I think it's an important distinction. >> >> I thought 'a'. 'b' is a constant expression and 'ab' is a constant value. Correct me if I am wrong. >> > Literals only is OK. Was/is there plans to allow constant expressions? I believe it's been discussed a few times but I think it's highly unlikely due to the way the engine works. As I said in my reply to shiplu, class constants and member variables are defined not evaluated, so making expressions possible is a fairly major modification for, what I see as fairly minimal benefit. There's definitely an argument to be made that a class definition should not contain anything that needs to be evaluated. I certainly see it as breaking the basics of object oriented design. > It just made me wonder if I was doing something wrong. Technically you were, but nobody died so it's ok :) -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/