From: Joel VanderWerf Date: 2001-11-26T10:29:56+09:00 Subject: [ruby-talk:26481] Re: Table: Ruby versus Smalltalk, Objective-C, C++, Java; Avi Bryant wrote: > However, not all cases where closures are wrapped by macros in lisp > are as easily replicated in Ruby. For example, assuming Ruby blocks > introduced a new lexical scope (which they unfortunately don't, but > never mind), the expansion of a lisp let statement in ruby looks like: > > proc{|x, y| do_something() }.call(a,b) > > This can be improved to: > > let(a,b){|x, y| do_something() } > > but it still ain't as pretty as lisp. There is also for x,y in [["a","b"]] do z=x+y end Syntax is prettier, but this example reinforces your point about lexical scope and blocks--'z' stays in scope. > And of course there are scores of uses for macros that have nothing to > do with closures. A classic one is embedding domain-specific > dialects, such as lispified HTML - the ruby cgi library is nice, but > it's not as clean or as general as the typical I'd vote for some kind of hygienic macro in Ruby, so we could create embedded languages with clean, idiomatic syntax. -- Joel VanderWerf California PATH, UC Berkeley mailto:vjoel@path.berkeley.edu Ph. (510) 231-9446 http://www.path.berkeley.edu FAX (510) 231-9512