Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【特性】约束变量声明+初始化结构(var <variable> <init>) #9

Open
bd4sur opened this issue Sep 5, 2019 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@bd4sur
Copy link
Owner

bd4sur commented Sep 5, 2019

特性描述:增加(var <variable> <init>),用于声明一个变量<variable>(即建立当前词法作用域上的一个约束变量绑定),并用<init>参数初始化其值。新声明的变量在作用域内是全局有效的,这类似于JavaScript的var变量声明,以及RnRS规定的letrec

为什么要增加这个结构?因为(set! var val)只能修改已绑定的变量为已求值的右值参数,而(define var init)的右值参数只能是未经求值的词法节点把柄/立即值/函数所在IL代码的标签。二者的功能某种程度上是正交的,这一点与RnRS中定义的有所不同。

实现思路:接续执行defineset!。在实现卫生宏之前,在编译器层面实现之。

@bd4sur bd4sur added the enhancement New feature or request label Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant