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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Wren: A classy little scripting language

136 点作者 StylifyYourBlog超过 10 年前

13 条评论

captaincrowbar超过 10 年前
For those who don&#x27;t know, this is from Robert Nystrom, author of Game Programming Patterns: <a href="http:&#x2F;&#x2F;gameprogrammingpatterns.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;gameprogrammingpatterns.com&#x2F;</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7634734" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7634734</a>
tonyg超过 10 年前
I like the idea very much, and the brevity and clarity of the implementation is pleasant. However, there are a few problems with it:<p><pre><code> \\&#x2F;&quot;- \_&#x2F; wren v0.0.0 &gt; var F = new Fn { | x | F.call(x + 1) } &gt; IO.print(F.call(10)) Segmentation fault </code></pre> This shows two things. (1) it&#x27;s not yet a &quot;safe&quot; language implementation; (2) it doesn&#x27;t support proper tail calls. Both are fixable, of course, but the lack of proper tail calls is a Bad Language Smell.<p>Its syntax is also a little strange. The following isn&#x27;t accepted by the parser:<p><pre><code> var F = new Fn { | x | if (x == 0) { return x } else { return F.call(x - 1) }} IO.print(F.call(10)) </code></pre> but the same file with extra newlines is accepted just fine:<p><pre><code> var F = new Fn { | x | if (x == 0) { return x } else { return F.call(x - 1) } } IO.print(F.call(10)) </code></pre> It also makes me a little sad that<p><pre><code> var F = new Fn { 0 } </code></pre> returns 0, while<p><pre><code> var F = new Fn { 0 } </code></pre> returns null.
评论 #8827649 未加载
abcd_f超过 10 年前
&gt; <i>The codebase is ... lovingly-commented</i> [0]<p>For what it&#x27;s worth, I absolutely <i>love</i> reading this sort of spanning descriptive comments. It makes the code that much more interesting and gives it a healthy dash of personality.<p>I used to work with a guy who&#x27;d have header files start with pagefuls of comments with ASCII diagrams, book references, complete design rationale and what not, only to follow with just a handful of rather terse declarations, which still would be immediately clear thanks to the preceding narrative. That was so damn beautiful.<p>[0] <a href="https://github.com/munificent/wren/blob/46c1ba92492e9257aba6418403161072d640cb29/src/wren_value.h#L378-L433" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;munificent&#x2F;wren&#x2F;blob&#x2F;46c1ba92492e9257aba6...</a>
评论 #8826896 未加载
pierrec超过 10 年前
Seems like a very cool language. Fibers are really just coroutines, right? The `Fiber.run` method allowing you to completely wreck the stack seems a bit dangerous at first glance.<p>The everything-is-a method approach is also really neat. For example, it&#x27;s neater than C#&#x27;s half-arsed approach where you can have public fields but it&#x27;s not recommended. However, I find there should still be an easy way of creating public properties. It&#x27;s useful when all you want is a structure holding a bunch of values instead of a full-featured class. From what I can see, the shortest way of creating a public property in Wren seems to be:<p><pre><code> class Cat { new { _name = defaultName } name { _name } name=(value) { _name = value } } </code></pre> That can be a lot of boilerplate, especially when you need lots of public properties. But that&#x27;s just a minor nitpick, of course. I&#x27;m looking forward to actually trying this language, but I&#x27;m not sure about its level of completeness right now. It seems like everything is pretty complete, apart from some parts of the documentation.
评论 #8826822 未加载
untothebreach超过 10 年前
I love munificent&#x27;s opinions on programming langugaes (wish he&#x27;d never given up on magpie...), and I can&#x27;t wait to try this one out.<p>Unfortunately it doesn&#x27;t build under GCC on linux right now, so use clang if you want to try it out.
评论 #8826562 未加载
评论 #8826832 未加载
phyllostachys超过 10 年前
I&#x27;m wondering how munificent feels about Squirrel[1]. It seems like Wren is looking to fill the same niche that Squirrel fits. So I guess my question is, how are they different, or, how is Wren better?<p>[1] - <a href="http://squirrel-lang.org/" rel="nofollow">http:&#x2F;&#x2F;squirrel-lang.org&#x2F;</a>
评论 #8828006 未加载
ac2u超过 10 年前
Not often I find a C project that can compile to JS via emscripten without too much work.<p><a href="http://i.imgur.com/XMZE04i.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;XMZE04i.png</a><p>If it takes off for game engines then it could be used for scripting canvas&#x2F;webgl games too.
评论 #8828319 未加载
jayvanguard超过 10 年前
My usual reaction to these things is &quot;does the world really need another language&#x2F;framework?&quot;<p>But this is actually a cool little language with well thought out features. I can see it being very useful for embedding.
Havvy超过 10 年前
&quot;There are lots of scripting languages out there, but many have unusual or non-existent object models. Wren places classes front and center.&quot;<p>Does it make me unusual to find classical object models shouldn&#x27;t be considered a &#x27;usual&#x27; object model?
评论 #8826636 未加载
samirmenon超过 10 年前
This seems like a wonderful language for game development. I wonder if there will be some kind of graphics support, or if I can use the C API (when it is finished).
评论 #8827150 未加载
jafingi超过 10 年前
Great work! Love the well-documented source. Will definitely look through it and try out the language.<p>I have used Swift quite a lot in 2014, and loved the way to do ranges. But it&#x27;s the complete opposite of Wren:<p>1...8 includes BOTH 1 and 8. Wren would not include 8.<p>Is this an error in the documentation, or the actual design of the language?<p>In the beta of Swift, 1..8 was not including 8. But I really like a change in the final version where it instead is done using 1..&lt;8<p>It makes it much easier to discern between the two;<p>1...8 1..8<p>vs.<p>1...8 1..&lt;8
评论 #8828317 未加载
JadeNB超过 10 年前
I know it&#x27;s not really substantive, but it&#x27;s tweaking my OCD: why does &#x27;small&#x27; in the list of adjectives in the marketing code block have an embedded newline?
评论 #8827161 未加载
soapdog超过 10 年前
Wren appear very cool but I think Finch is more my cup of tea. Anyone has feedback on Finch or an opinion on Finch vs Wren?
评论 #8826774 未加载
评论 #8827664 未加载