Hi,
On 07/17/2012 05:40 AM, Nicholas Curtis wrote:
Great Idea, would love to see current standard library in a legacy
namespace and a new standard library implemented as methods of
primitive types.
The idea to separate old and new behaviour has some charm.
$string = "Hello, World";
echo $strong->toUpper(); // HELLO, WORLD
$int = 3;
echo $int->round(2); // 3.0
While still preserving $legacy.strTopUpper($string) and $legacy.round($int)
I wouldn't do that because it implies two things:
- you have to change existing code (if I understand your syntax
correctly)
- you could mix old and new style in one file
Somebody proposed (in some other thread some weeks ago) to introduce some code versioning. IIRC he proposed the "<?php6" opening tag instead of "<?php". (I'd prefer something like "<?php+" - but that's just a naming thing. And of course: You could still mix different styles in one file - but not in one php block. And that's easier to handle by coding conventions in the team.)
Versioning could be a chance to evolve the language and not to mess with existing code. BUT: I don't know if that's doable internally. And it's probably a lot of work...
Regards
Thomas