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
改进复合语句的语义 #19
Labels
Milestone
Comments
考虑到支持 if, switch 有值的成本比较高,并且和常规语言有较大差异,打算改变 statement 语义,不再是个值。这样 if, switch, for 语句也就没有值。 |
xushiwei
added a commit
that referenced
this issue
Apr 9, 2016
xushiwei
added a commit
that referenced
this issue
May 21, 2016
xushiwei
added a commit
that referenced
this issue
May 21, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
当前的结果为 nil。如果我们认为:复合语句 { s1; s2; ...; sN; } 的值为 sN,那么以上表达式就等价于:
另外,函数的语义也可以调整:
如果中间没有出现 return,那么 foo() 的结果为 nil。但是我们可以调整为值也是 sN。这样 qlang 的 fn 就有点类似函数式的味道了。示例:
The text was updated successfully, but these errors were encountered: