Skip to content

Instantly share code, notes, and snippets.

@wwj718

wwj718/zh_dsl.st

Created Jul 23, 2019
Embed
What would you like to do?
目标: 构建中文dsl
Date today
"hello" size
'hello' executeMethod: ('hello' class lookupSelector: #size)
[:x | Date executeMethod: (Date class lookupSelector:x) ] value: #today
|日期 今天 周|
日期 := [:x | Date executeMethod:(Date class lookupSelector:x) ].
今天 := #today.
日期 value: 今天.
|日期 今天 周|
日期 := [:x | Date perform: x].
今天 := #today.
周 : = #weeks
日期 value: 今天.
'hello world' perform: #size
'hello world' perform: #size.
'hello world' perform: 'size' asSymbol.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.