Concatenative topics
Concatenative meta
Other languages
Meta
Many languages, such as Common Lisp and Smalltalk, support named parameters at the call site:
(send-email :from "jack@aol.com" :to (list "jill@aol.com") :subject "Hello there" :body body)
In Factor, the closest equivalent is to define a tuple and set its slots, then pass it to another word. This looks very nice in Factor, because tuple slot setters leave the tuple on the stack, and so can be chained together without any stack shuffling:
<email> "jack@aol.com" >>from { "jill@aol.com" } >>to "Hello there" >>subject body >>body send-email
This idiom does not depend on any additional language features, and indeed it is more flexible because we can factor out some of the setter calls into a new word. We can also pass around the email object without sending it off immediately.
This revision created on Fri, 2 Jan 2009 19:55:35 by slava