From: W Kent Starr Date: 2002-09-05T02:23:08+09:00 Subject: Re: Ruby aesthetics On Wed, 2002-09-04 at 02:56, Gavin Sinclair wrote: > My frame-of-reference for good language design is Ruby. So compared to > Ruby, I would add: > - list comprehensions > - calling procs would look like real functions, not arrays! > e.g. id = proc { |x| x }; id(12) # not id[12] > - first-class functions (someone please correct me here) > - def within def > > The first one is already discussed elsewhere in this thread, and I don't > want to sound like a zealot just by mentioning it here. The others > probably have issues; I've not thought it through. > While calling procs as foo(x,y) is consistent with other languages, one must remember IMO that one of Ruby's strong points is its "expressiveness". Procs -aren't- functions in the strictist sense, but arguments -are- arrays. :-) Hense, foo[x,y]. Why do we need first-class functions? Ruby is really a collection of base methods with built-in extensibility (either via extension of existing methods or the creation of new ones.) Def within def? Why not simply: def foo() # do something end def bar() #do somehing x = foo # do something with x end Collections of short methods (which could be methods calling other methods) appears more easily maintainable IMO. This was a point of discussion awhile ago on the list here. Regards, Kent Starr