Ask HN: If there was a CoffeeScript for PHP, what features would you like?
What kind of features would you like in such a language?
What kind of features would you like in such a language?
2. better way to define stdClass objects (json-esque). other than (object)array('foo'=>'bar').
3. chaniable interfaces for lots of stuff that currently requires storing results in temp vars.
4. have closures automatically "use" all local scope variables without needing to explicitly define them (like js) - this could be problematic though if you expect to reuse variable names...
have anything implementing all necessary array and iterator interfaces be passable to functions that take arrays. this is really a core language feature though, not sugar.
there is a great list of warts you can start itching here: http://phpsadness.com/
$foo = MyFunction()[2];
It's the one feature in PHP 5.4 that made me genuinely happy.
Another thing I'd love is a doctype of sorts for PHP. So I could go:
<?php uses "5.1.2"; ....
and then the PHP engine will treat itself as if it is PHP 5.1.2 or whatever. Yeah, not going to happen ever, but it'd be nice.
dot notation instead of ->
methods instead of functions where possible (eg: "test".replace("t", "b"); )