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

XS-编程语言 #267

Closed
kulics opened this issue Jan 30, 2019 · 4 comments
Closed

XS-编程语言 #267

kulics opened this issue Jan 30, 2019 · 4 comments

Comments

@kulics
Copy link

kulics commented Jan 30, 2019

一个只用符号做关键字的编程语言,设计上有点意思。
https://github.com/kulics/xs

@ruanyf
Copy link
Owner

ruanyf commented Jan 31, 2019

收入第 46 期。不过说实话,我还是不太明白,它的语法何以解决了那些问题。

@kulics
Copy link
Author

kulics commented Feb 23, 2019

@ruanyf 我的理解是,简洁的语法对阅读和书写很有帮助,如果能用尽可能少的语法表达逻辑,处理关键问题就更得心应手。
例如很繁杂的 if else if ,用 xs 的表达方式就舒适很多,语法负担少了,注意力不会被浪费与逻辑无关的地方上。

if (a == 1) {
} else if (b == 2) {
} else if (c == 3) {
} else {
}

? a == 1 {
} b == 2 {
} c == 3 {
} _ {
}

@ruanyf
Copy link
Owner

ruanyf commented Feb 23, 2019

这样的话,打字确实少了,但是可读性差了。

@kulics
Copy link
Author

kulics commented Feb 23, 2019

@ruanyf
可读性这点可能因人而异吧,有的人喜欢偏向自然语言的可读性,有的人喜欢符号化语法糖的可读性。
我更偏向后者,例如

加法运算可以是
add(a, b)
但是符号化的方式使用起来更加顺手
a + b

废了很大功夫把文字关键字去掉,并保持很少的符号之后,现在可读性在一个较容易适应的程度。
现在没有IDE提示的情况下,写了一些项目还是能比较清晰地辨别逻辑,可读性不是问题。

@kulics kulics closed this as completed Mar 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants