`
RednaxelaFX
  • 浏览: 3016631 次
  • 性别: Icon_minigender_1
  • 来自: 海外
社区版块
存档分类
最新评论

Squirrel 2.2发布了

阅读更多
快一个星期前的事了,不过我之前都没留意到。

squirrel 2.2 is out
fagiano 写道
***version 2.2 stable***

-added _newslot metamethod in classes

-added enums added constants

-added sq_pushconsttable, sq_setconsttable

-added default param

-added octal literals(thx Dinosaur)

-fixed debug hook, 'calls' and 'returns' are properly notified in the same number.

-fixed a coroutine bug


SourceForge上的下载点

不过,==,他们在论坛讨论里有提到svn trunk,但我没找到地址。记下这个问题。

------------------------------------------------------------------

话说Squirrel 3.x的设计讨论里,有一点是关于“是否自动将自由变量绑定到内部嵌套作用域”的问题。
在Squirrel 2.1.2的参考手册里,第20页有这么一段:
引用
Free variables
Free variables are variables referenced by a function that are not visible in the function scope. In the following example the function foo() declares x, y and testy as free variables.
local x=10,y=20
testy <- “I’m testy”

function foo(a,b):(x,y,testy)
{
    ::print(testy);
    return a+b+x+y;
}

The value of a free variable is frozen and bound to the function when the function is created; the value is passed to the function as implicit parameter every time is called.

不知道为什么,我会对这种没有遵循lexical scoping的做法有兴趣。或许是因为至少它提供了一种获取free variable的的手段,而不像TJS2那样想用free variable都用不了。而这种做法实现起来又比完全遵守lexical scoping来得方便…… =_=||

...这个时候也会想起Python的self。呵呵,Guido看来是没打算把self从方法声明中去掉呢。

------------------------------------------------------------------

也有看到尝试制作Squirrel到.NET的绑定的,这里。只是直觉,不过我觉得CLI的优点就是"common object",类似Lua/Squirrel的栈的解决方案用在CLI上到底有没有它原本在C/C++意义呢?

挖掘老帖,发现Alberto以前在这里说过:
引用
Squirrel RC is very fast because of the register based architecture(the majority of interepreted languges are stack-machines) and a conservative way to cleanup function's stacks. It also has a backup garbage collector(mosly for debug pouposes) and recently I've added weak references so you can create cycles without locking your mem.

咦?他是说register-based virtual machine会比stack-based virtual machine快?如果是实际硬件的话那肯定是register-based的快,但如果都是软件实现的VM,两者差不了多少才对。
这恐怕还是得看中间代码到具体执行这中间的过程是如何实现的吧。没人说stack-based instruction set就一定要真的建些个stack出来才能执行……stack-based的主要好处应该是较小的字节码吧(相对register-based来说,等于有隐含参数,因而节省了一些数据)
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics