toString() should work as expected, because you first realize that this is a
class, so it is concatenation and toString() should be called.

As I understand namespaces are resoved in compile time, so when it comes to
executing code - byte code for MY_CONST.MyCLASS::staticMethod() and
MY_NAMESPACE.MyCLASS::staticMethod() are to different opcodes, right?
I know that there is a patch for resolving constant values on compile time,
if it is applied to 5.3 - that all constants should become values in
opcodes. On compile time we know what constants we have and what namespaces
we have before current position in code - if we get something not defined
neither as constant, neither as namespace - treat that as undefined
constant, because if you forget to import a namespace - you'r will get a
fatal error anyway - this is one way. Other way - make such error fatal, so
programmer will fix it the minute it happened and will make sure he uses it
right.
Ok, we got situation then constant name and namespace name are the same -
throw a fatal error like if we had to functions with same name.

Above written is on assumption I correctly understood how PHP parser
translates the code into opcodes.

Well, we can do it the most easy way - use : for namespace. It has no
drawbacks as . or any other separators does (::: is too long, \ is special
symbol, etc),  is completely new in PHP and defines that it is a namespace
100%. Everybody happy, no name conflicts, 5.3 is pushed out with completely
working namespaces without any need to cut functions and constants.
2008/9/29 Richard Quadling <[EMAIL PROTECTED]>

> 2008/9/29 Arvids Godjuks <[EMAIL PROTECTED]>:
> > String concatenation woun't be affected, because you can't concatenate
> class
> > definitions like in my example.
> > To concatenate you should use variables or strings/numbers. So I don't
> see
> > any complications with that.
> >
> > 2008/9/29 Stan Vassilev | FM <[EMAIL PROTECTED]>
> >
> >>
> >> Hi,
> >>
> >> I think we need string concatenation here and there ;)
> >>
> >> Regards,
> >> Stan Vassilev
> >>   ----- Original Message -----
> >>  From: Arvids Godjuks
> >>  To: Stan Vassilev | FM
> >>  Cc: PHP Internals List
> >>  Sent: Monday, September 29, 2008 9:19 AM
> >>  Subject: Re: [PHP-DEV] solving the namespace conflict issues
> >> betweenfunction/staticmethod class constant/ns constant
> >>
> >>
> >>  Maybe just use  .  as namespace separator.
> >>
> >>  MyNameSpace.SomeClass::_getInstance()->SomeDBClass->Query();
> >>
> >>  That will eliminate all resolution problems, it isn't used for anything
> >> than string concatenation, and it's one symbol. It's 100% better than \
> and
> >> I think it would be better than ::: or :::: and so on.
> >>  A point against \ is that it has special meaning in every programming
> >> language as escape character, so it is 100% bad to use it.
> >>
> >
>
> What would happen to a class with a toString() method?
>
>
> --
> -----
> Richard Quadling
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to