RE: [PHP-DEV] Re: PHP 5.1 (Or How to break tousands of apps out there)
| From: | Dmitry Stogov | Date: | Mon, 28 Nov 2005 20:38:12 +0000 |
| Subject: | RE: [PHP-DEV] Re: PHP 5.1 (Or How to break tousands of apps out there) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-20776@lists.php.net to get a copy of this message | ||
PHP syntax doesn't allow usage of _CLASS_NAME_ and _CONSTANT_ in the same
language context.
So, about what conflict are you talking?
$a = new A::B::C; - class
$a = A::B::C; - constant
What is the difference with current PHP code?
$a = new C;
$a = C;
Dmitry.
> -----Original Message-----
> From: Marcus Boerger [mailto:helly@php.net]
> Sent: Monday, November 28, 2005 11:23 PM
> To: Dmitry Stogov
> Cc: 'Bob Silva'; 'Christian Schneider'; 'PHP internals'
> Subject: Re: [PHP-DEV] Re: PHP 5.1 (Or How to break tousands
> of apps out there)
>
>
> Hello Dmitry,
>
> featurismus: namespaces in namespaces *and* constants. But
> as i said even without conflicts it causes trouble in your
> brain. Since the syntax would not clearly differenciate the two.
>
> regards
> marcus
>
> Monday, November 28, 2005, 9:10:04 PM, you wrote:
>
> > Hi Marcus,
>
> > It worked. :)
> > Even with nested classes.
>
> > However it didn't care about "subnamespaces". I don't know
> what do you
> > mean with it. Nested namespaces? Or complex namespace names like in
> > Java (java.lang)?
>
> > Thanks. Dmitry.
>
> >> -----Original Message-----
> >> From: Marcus Boerger [mailto:helly@php.net]
> >> Sent: Monday, November 28, 2005 10:15 PM
> >> To: Dmitry Stogov
> >> Cc: 'Bob Silva'; 'Christian Schneider'; 'PHP internals'
> >> Subject: Re: [PHP-DEV] Re: PHP 5.1 (Or How to break tousands
> >> of apps out there)
> >>
> >>
> >> Hello Dmitry,
> >>
> >> your patch wasn't complete. There are conflicts as soon as
> >> you have subnamespaces or constsants.
> >>
> >> marcus
> >>
> >> Monday, November 28, 2005, 9:27:19 AM, you wrote:
> >>
> >> > Marcus,
> >>
> >> > You saw my patch that works with "::" and doesn't break any
> >> > scripts.
> >>
> >> > Dmitry.
> >>
> >> >> -----Original Message-----
> >> >> From: Marcus Boerger [mailto:helly@php.net]
> >> >> Sent: Saturday, November 26, 2005 3:42 PM
> >> >> To: Bob Silva
> >> >> Cc: 'Christian Schneider'; 'PHP internals'
> >> >> Subject: Re: [PHP-DEV] Re: PHP 5.1 (Or How to break tousands
> >> >> of apps out there)
> >> >>
> >> >>
> >> >> Hello Bob,
> >> >>
> >> >> it is only awkward because you want to turn php into
> c++. We are
> >> >> a different language here and thus can chose any separator that
> >> >> works for us. And neither : nor :: work. Instead from
> keeping us
> >> >> from working by having to explain this over and over and over
> >> >> again i suggest you show me a working patch that does not break
> >> >> trillions of php scripts.
> >> >>
> >> >> marcus
> >> >>
> >> >> Saturday, November 26, 2005, 3:36:42 AM, you wrote:
> >> >>
> >> >> > For what its worth (not much), I'd rather give up namespace
> >> >> constants
> >> >> > and use : rather than enforce whitespace which is
> just BAD from
> >> >> > a language perspective. Makes it feel like programming in
> >> bash. The
> >> >> > concept behind namespaces (in PHP at least) is rooted
> in OOP, so
> >> >> > requiring a class just to have constants in your namespace
> >> >> isn't too
> >> >> > much to ask for. The parser should always be able to handle
> >> >> > <namespace>:<class>::<whatever> and not conflict with
> >> other syntax.
> >> >>
> >> >> > If we are truly stuck with \ so be it, but I think
> >> >> alternatives with
> >> >> > some level of compromise should be considered before \ is
> >> >> > settled upon. It's just plain awkward IMO.
> >> >>
> >> >>
> >> >> > Bob Silva
> >> >>
> >> >>
> >> >> >> -----Original Message-----
> >> >> >> From: Christian Schneider [mailto:cschneid@cschneid.com]
> >> >> >> Sent: Friday, November 25, 2005 4:42 PM
> >> >> >> To: Marcus Boerger
> >> >> >> Cc: PHP internals
> >> >> >> Subject: Re: [PHP-DEV] Re: PHP 5.1 (Or How to break
> >> >> tousands of apps
> >> >> >> out
> >> >> >> there)
> >> >> >>
> >> >> >> Marcus Boerger wrote:
> >> >> >> > here again namespaces would be perfect. Given a lib
> >> >> that doesn't
> >> >> >> prefix
> >> >> >> > you'd simply do:
> >> >> >> > namespace LibNameHere { reqire "some_lib_include"; }
> >> >> >> > and be
> >> >> >> > done...wohooo :-)
> >> >> >>
> >> >> >> Only if newly introduced PHP core classes use a namespace
> >> >> too. You'll
> >> >> >> have to use PHP\Date (or the like) if you want to avoid
> >> >> conflicts in
> >> >> >> existing code. Plus maybe something like "import PHP\Date
> >> >> as Date" or
> >> >> >> something along these lines if you want to avoid
> PHP\ in newly
> >> >> >> written code where you know that there is no Date class yet.
>
>
>