Re: [PHP-DEV] Patch-tastic!
On Wed, 2002-06-05 at 10:44, Ilker Cetinkaya wrote: Sebastian Bergmann [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Andrei Zmievski wrote: The latest one changes some operators. Nice, but why not overload + for strings to do the concatenation? i totally agree, overloading + for string concat is really desireable. imho using - for member object access is ok. i see php more likely to be a c++ derivate than java or c#. just my .02c I guess you should have been here when PHP 3 came out and + suddenly no longer did string concatenation. There has been consensus on not overloading operators since then. Don't expect this to change. - Stig -- Stig Sæther Bakken, Fast Search Transfer ASA, Trondheim, Norway http://pear.php.net/wishlist.php/ssb -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch-tastic!
Am Mittwoch, 5. Juni 2002 10:44 schrieb Ilker Cetinkaya: Nice, but why not overload + for strings to do the concatenation? i totally agree, overloading + for string concat is really desireable. No, it is a nightmare. PHP is a dynamically typed language, that is, the actual language objects know their type, while object names (variable identifiers) are untyped. Also, PHP automatically changes types of language objects as needed. Consequently, most developers do not know the actual type of their variables (it is not seen anywhere unless you specifically ask for it), and most of the time they don't actually care for it. For example, when was the last time you noticed or even cared that all arguments of your program (_GET, _POST, _COOKIE) are actually string type, even if they are pure numeric strings? Overloading + would suddenly require that developers care about type, and would force them to write expressions like $c = $a . $b; as $c = (string) $a + (string) $b; just to make sure. Not actually an improvement. This actually a deeper problem, as we have seen in the last few discussions here on the list. PHP may remotely resemble C, C++ or even Java. It isn't. And it isn't intended to be. If you treat it like any of these statically typed, compiled, and far more traditional languages, you bleed. Big time. Actually, I believe that Javascript has the programming and execution model that comes closest to PHP of all the C lookalike languages. Kristian -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch-tastic!
[ I copy this to php-dev again, despite the fact that Ilker sent this to me in private mail, because I want to promote the concept of warnings for named accesses to _-members again. Privacy in C++/Java style will raise a lot of issues on this list again, if it is introduced to PHP. My proposal will have less syntactial impact, and will better blend with the general style of the language at this time. ] Am Donnerstag, 6. Juni 2002 11:58 schrieb Ilker Cetinkaya: know how objects and inheritance is done in javascript (ecma respectively?). have you ever seen private members on objects of js? In Javascript, each object is it's own class. You create new objects basically by duplicating some initial object, that is, Javascript's new is actually a clone. This is conceptually close to what PHP 4 does, where you can have preinitialized member variables in an object, and where you can at runtime add member variables to an object (and you could for a short time even add member functions thanks to Andrej, I believe). PHP 4 deviates from (I would even say obscures this) by not having an explicit clone operator (but PHP 4 implicitly clones every time due to unexpected value-semantics). Regarding the concept of private: Private member variables and private member functions are a nuisance anyway in a language where you can add members to an object at runtime. Also, in it's wake the concept of private introduces a lot of syntactic complexity as well, such as the need for protected variables and functions, and a friend relationship between classes. You will immediately see discussions around this issue once privacy is introduced. In Javascript-like languages, the same effect can be had by simply issuing a warning whenever accessing a member variable or member function with a name starting with _ through a named variable. That is, you would see warnings for $a-_private_slot = 10; $b = $a-_private_slot; $c = $a-_private_function(); but not when accessing the same internally using $this: $this-_private_slot = 10; $b = $this-_private_slot; $c = $this-_private_function(); A coder that must access private member variables and member functions through a named variable (and there are a lot of legitimate reasons for this, namely all metaprogramming applications including debuggers, rpc proxies, serializers and the like) can easily shut of this warning: $a-_private_slot = 10; $b = $a-_private_slot; $c = $a-_private_function(); will all execute warning-free, and clearly mark these statements as violating the encapsulation-contract of conventional OO programming, the same way a type-cast marks a violation of the typing contract in C, C++ or other statically typed languages (and there are a lot of legit reasons for that, too). This implementation of private has several advantages, one of them being that it is elective, another of them being that it is the minimal syntactic extension of current PHP, and a third of them being that it is compatible with current PEAR. namespaces? statics? consts? These concepts do not contradict a dynamically (this is different from loosely!) typed language concept. in closing, i have to admit that such a change would be a big issue in aspects of compatibility, juggling, parsing and object handling. therefore i'm sure it's not going to be realized. but still i'd desire it. just to be more stricty. I suggest you try Java. You seem to want it. Kristian -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch-tastic!
Sebastian Bergmann [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Andrei Zmievski wrote: The latest one changes some operators. Nice, but why not overload + for strings to do the concatenation? i totally agree, overloading + for string concat is really desireable. imho using - for member object access is ok. i see php more likely to be a c++ derivate than java or c#. just my .02c -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch-tastic!
Sebastian Bergmann wre: Andrei Zmievski wrote: The latest one changes some operators. Nice, but why not overload + for strings to do the concatenation? No way. Many people don't know (think newbies here) what types their variables have, and don't care. This feature would quickly introduce more bugs into PHP-programs than register_globals did in its entire lifespan. Operators should be as type-independent as possible. Only objects might be an exception. regards Wagner -- When did ignorance become a point of view? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Patch-tastic!
In case you've missed it, I have been putting up unofficial patches for PHP on my website. The latest one changes some operators. See the website for more details. Cheers, -Andrei http://www.gravitonic.com/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch-tastic!
On Tue, Jun 04, 2002 at 10:44:17PM -0500, Andrei Zmievski wrote: In case you've missed it, I have been putting up unofficial patches for PHP on my website. The latest one changes some operators. See the website for more details. Is there a reason why you don't just post them here? -aaron -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch-tastic!
Andrei Zmievski wrote: The latest one changes some operators. Nice, but why not overload + for strings to do the concatenation? -- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php