From: "David A. Black" Date: 2005-10-14T07:54:50+09:00 Subject: Re: Default argument values for blocks Hi -- On Fri, 14 Oct 2005, Trans wrote: >> This one was proposed long ago as a way to declare a var whose scope is >> outside the block: >> >> lambda { puts foo } > > All sorts of things can work, one that looks quite nice: > > lambda { foo = 1|2 -> puts foo } > > But I would suggest that everyone give the -> () {} notation chance. I > really hated it at first too, but it has grown on me and I am starting > to like it even more then goal posts b/c of the way it brings the > parameters outside of the block. That's one of the things I don't like about it. Just on a kind of visceral level, { ... } conveys a much greater sense of a "closure". Actually, if we must have -> then it would be better to just make it look more like a method definition, but anonymous: def x(a,b) ... end -> (a,b) ... end and just forget about the {}. ->(){} just requires too much visual parsing and explaining. David -- David A. Black dblack@wobblini.net