Skip to content

Instantly share code, notes, and snippets.

@wwj718
Created July 23, 2019 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwj718/ba5300c56d5b884785f04f8b65621bbf to your computer and use it in GitHub Desktop.
Save wwj718/ba5300c56d5b884785f04f8b65621bbf to your computer and use it in GitHub Desktop.
目标: 构建中文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