Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # operators.io
- OperatorTable addAssignOperator("->", "setLambda")
- # code.io
- Object setLambda := method(
- slot_name := call message arguments at(0) name asMutable replaceSeq("\"","")
- block_body := call message arguments at(1)
- object := call target
- object setSlot(slot_name, block(
- block_body doInContext(object)
- ) call)
- )
- # old:
- man := Object clone
- man name := "Andrey"
- man getName := method(name println)
- man getName # => "Andrey"
- # new syntax:
- man := Object clone
- man name -> "Vorobey"
- man getName -> name println
- man getName # => "Vorobey"
Add Comment
Please, Sign In to add comment