Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Basic Namespace Requirements [RSS Feed]

#1 Nov. 28, 2005 22:05:22

Jessie H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


All,

After seeing Dmitry's patch, all he is allowing inside a module are import
statements and classes.

So, the question is, can we scrap both namespace constants and namespace
functions and just stay with classes (as was agreed on several months ago,
Andi himself agreeing to it)? This would make the patch smaller, simpler,
AND would allow me to reuse the "::" operator (and there would be no
conflicts with ternary operations).

I think this is the best solution thus far. If any one of you still feels a
need for constants/functions, PLEASE show me a _valid_ example that cannot
be accomplished by just simply putting the constant/function inside a class
in the namespace.

If I don't hear of any valid arguments, then I'm going to go ahead and scrap
constants and functions and then concentrate on the final details of the
patch.


Regards,

Jessie Hernandez

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 Nov. 28, 2005 22:40:50

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


Hello Jessie,

i already showed that dropping constants in namespaces leeds to static
classes or private classes. So we are just shifting here. Instead of doing
work that is worth nothing you should simply try to come up with a working
patch using a working separator which can clearly only be "\".

best regards
marcus

Monday, November 28, 2005, 11:04:43 PM, you wrote:

> All,

> After seeing Dmitry's patch, all he is allowing inside a module are import
> statements and classes.

> So, the question is, can we scrap both namespace constants and namespace
> functions and just stay with classes (as was agreed on several months ago,
> Andi himself agreeing to it)? This would make the patch smaller, simpler,
> AND would allow me to reuse the "::" operator (and there would be no
> conflicts with ternary operations).

> I think this is the best solution thus far. If any one of you still feels a
> need for constants/functions, PLEASE show me a _valid_ example that cannot
> be accomplished by just simply putting the constant/function inside a class
> in the namespace.

> If I don't hear of any valid arguments, then I'm going to go ahead and scrap
> constants and functions and then concentrate on the final details of the
> patch.


> Regards,

> Jessie Hernandez




Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 Nov. 29, 2005 08:49:29

Stanislav M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


MB>>work that is worth nothing you should simply try to come up with a working
MB>>patch using a working separator which can clearly only be "\".

That's one creative way of using "working", "clearly" and "only" with
meanings that I was not familiar with before. :)

--
Stanislav Malyshev, Zend Products Engineer
http://www.zend.com/+972-3-6139665 ext.115

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 Nov. 29, 2005 11:07:07

Matthias P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


> Von: Jessie Hernandez
> So, the question is, can we scrap both namespace constants
> and namespace functions and just stay with classes (as was
> agreed on several months ago, Andi himself agreeing to it)?
...
> I think this is the best solution thus far. If any one of you
> still feels a need for constants/functions, PLEASE show me a
> _valid_ example that cannot be accomplished by just simply
> putting the constant/function inside a class in the namespace.

Bart de Boer came up with a good reason for them so I'd like to re-post
his statement.

<quote>
Namespace constants can be handy if you'd want to include some library
that uses predefined constants and classes that might conflict with
other classes and constants in the script.

namespace someLib {

include('huge_conflicting_library_that_I_dont_want_to_reverse_engineer')
;

}
</quote>

Of course, that would not only require to put defines and
functions in namespaces, but variables as well.

namespace X {
var $foo = 1;
function bar($p) {}
}

X::bar(X::$foo);

which can, of course, not easily be distinguished from static class
members.

So is the whole "include-legacy-stuff-into-namespace"-approach beyond
the scope of what you're trying to do?

-mp.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 Nov. 29, 2005 15:38:03

Jessie H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


Matthias,

Simply put, const != define. Like I think Sara mentioned before, defines are
runtime-defined, and making it both compile-time/runtime defined based on
context will be really confusing.

Also, I'm not accepting variables in namespaces and this is not needed
either. So, yes, this is outside the scope of what I want to accomplish.


Regards,

Jessie

""Matthias Pigulla"" <> wrote in message


> Von: Jessie Hernandez
> So, the question is, can we scrap both namespace constants
> and namespace functions and just stay with classes (as was
> agreed on several months ago, Andi himself agreeing to it)?
...
> I think this is the best solution thus far. If any one of you
> still feels a need for constants/functions, PLEASE show me a
> _valid_ example that cannot be accomplished by just simply
> putting the constant/function inside a class in the namespace.

Bart de Boer came up with a good reason for them so I'd like to re-post
his statement.

<quote>
Namespace constants can be handy if you'd want to include some library
that uses predefined constants and classes that might conflict with
other classes and constants in the script.

namespace someLib {

include('huge_conflicting_library_that_I_dont_want_to_reverse_engineer')
;

}
</quote>

Of course, that would not only require to put defines and
functions in namespaces, but variables as well.

namespace X {
var $foo = 1;
function bar($p) {}
}

X::bar(X::$foo);

which can, of course, not easily be distinguished from static class
members.

So is the whole "include-legacy-stuff-into-namespace"-approach beyond
the scope of what you're trying to do?

-mp.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#6 Nov. 29, 2005 16:29:56

Bart d.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


I'm not sure I understand this problem. Isn't it doable to definedefines at runtime and then put them under a certain namespace? I'massuming namespaces are defined before defines?Ideally, I'd say there should be no code limitations inside namespaces.But if this poses technical problems. Then I think using only classesunder namespaces is better then no namespaces.Jessie Hernandez wrote:Matthias,

Simply put, const != define. Like I think Sara mentioned before, defines are
runtime-defined, and making it both compile-time/runtime defined based on
context will be really confusing.

Also, I'm not accepting variables in namespaces and this is not needed
either. So, yes, this is outside the scope of what I want to accomplish.


Regards,

Jessie

""Matthias Pigulla"" <> wrote in message
Von: Jessie Hernandez
So, the question is, can we scrap both namespace constants
and namespace functions and just stay with classes (as was
agreed on several months ago, Andi himself agreeing to it)?...I think this is the best solution thus far. If any one of you
still feels a need for constants/functions, PLEASE show me a
_valid_ example that cannot be accomplished by just simply
putting the constant/function inside a class in the namespace.Bart de Boer came up with a good reason for them so I'd like to re-post
his statement.

<quote>
Namespace constants can be handy if you'd want to include some library
that uses predefined constants and classes that might conflict with
other classes and constants in the script.

namespace someLib {

include('huge_conflicting_library_that_I_dont_want_to_reverse_engineer')
;

}
</quote>

Of course, that would not only require to put defines and
functions in namespaces, but variables as well.

namespace X {
var $foo = 1;
function bar($p) {}
}

X::bar(X::$foo);

which can, of course, not easily be distinguished from static class
members.

So is the whole "include-legacy-stuff-into-namespace"-approach beyond
the scope of what you're trying to do?

-mp.--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#7 Dec. 4, 2005 14:24:35

Timm F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


Hi,

> Hello Jessie,

> you should simply try to come up with a working
> patch using a working separator which can clearly
> only be "\".

Why is \ the only character that could work? Because it's unused? What about
for examole the tilde (~) or the exclamation mark (!)? - both of them are
prefixes only, so neither a!b nor a~b will conflict.

On the backslash: It'll be a bitch in places where you need the class name
as a string (reflection) because \ needs to be escaped withing a string.
Think: How many backslashes do you need in a regular expression using double
quotes to represent a single backslash (try to answer this question without
trying it out. Was it two? Three? four? Six?)

- Timm

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#8 Dec. 4, 2005 18:10:50

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


Hello Timm,

Sunday, December 4, 2005, 3:22:48 PM, you wrote:

> Hi,
>
>> Hello Jessie,
>
>> you should simply try to come up with a working
>> patch using a working separator which can clearly
>> only be "\".

> Why is \ the only character that could work? Because it's unused? What about
> for examole the tilde (~) or the exclamation mark (!)? - both of them are
> prefixes only, so neither a!b nor a~b will conflict.

Right, but doesn't make the code readable since once again you give
operators multiple meanings. And we don't want to become another perl, do
we?

> On the backslash: It'll be a bitch in places where you need the class name
> as a string (reflection) because \ needs to be escaped withing a string.
> Think: How many backslashes do you need in a regular expression using double
> quotes to represent a single backslash (try to answer this question without
> trying it out. Was it two? Three? four? Six?)

Wrong assumption. The \ won't need to be escaped.

Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#9 Dec. 4, 2005 18:36:56

Wez F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


On 12/4/05, Marcus Boerger <> wrote:
> > On the backslash: It'll be a bitch in places where you need the class name
> > as a string (reflection) because \ needs to be escaped withing a string.
> > Think: How many backslashes do you need in a regular expression using double
> > quotes to represent a single backslash (try to answer this question without
> > trying it out. Was it two? Three? four? Six?)
>
> Wrong assumption. The \ won't need to be escaped.

Err, what about "my\namespace" ?

--Wez.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#10 Dec. 4, 2005 18:42:42

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Basic Namespace Requirements


Hello Wez,

Sunday, December 4, 2005, 7:36:19 PM, you wrote:

> On 12/4/05, Marcus Boerger <> wrote:
>> > On the backslash: It'll be a bitch in places where you need the class name
>> > as a string (reflection) because \ needs to be escaped withing a string.
>> > Think: How many backslashes do you need in a regular expression using
>> > double
>> > quotes to represent a single backslash (try to answer this question without
>> > trying it out. Was it two? Three? four? Six?)
>>
>> Wrong assumption. The \ won't need to be escaped.

> Err, what about "my\namespace" ?

That would be the string "my" <newline> "namespace".
As a classname it would be "class namespace in namespace my".
I guess your point is how to use that in ""-$-expressions, right?
$bla = "${foo\bar::constant}";


Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Basic Namespace Requirements [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support