TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: If there was a CoffeeScript for PHP, what features would you like?

8 点作者 aoe大约 13 年前
There are many of us who cannot switch to another server side language, and would like a syntactic sugar on top of PHP.<p>What kind of features would you like in such a language?

3 条评论

leeoniya大约 13 年前
1. uniform function names and parameter orders. for example searching functions.<p>2. better way to define stdClass objects (json-esque). other than (object)array('foo'=&#62;'bar').<p>3. chaniable interfaces for lots of stuff that currently requires storing results in temp vars.<p>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...<p>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.<p>there is a great list of warts you can start itching here: <a href="http://phpsadness.com/" rel="nofollow">http://phpsadness.com/</a>
kaolinite大约 13 年前
Not really needed now that PHP 5.4 has it by default (though in reality it'll be a while before 5.4 is default), but I'd use it if it let me do the following:<p>$foo = MyFunction()[2];<p>It's the one feature in PHP 5.4 that made me genuinely happy.<p>Another thing I'd love is a doctype of sorts for PHP. So I could go:<p>&#60;?php uses "5.1.2"; ....<p>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.
pdenya大约 13 年前
better array syntax [] &#38; {}<p>dot notation instead of -&#62;<p>methods instead of functions where possible (eg: "test".replace("t", "b"); )