[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03893] Re: Array.uniq! returning nil

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-07-07 09:45:59 UTC
List: ruby-talk #3893
On Fri, 7 Jul 2000, Yukihiro Matsumoto wrote:

> If I create these methods from scratch, it is possible for me to make
> the bang methods always return self.  But CHANGING behavior will crash
> fair amount of programs.  Only options I can think of are:
> 
>   (a) introduce new methods (but not gsub!? please)
>   (b) introduce additional optional argument (as Hugh proposed in
>       [ruby-talk:03863])

	Thank you.  One more might be a new operator.  I don't know
	what to call it so I will call it cut for now, for the sake
	of argument: 

	a.modifier!().cut.method1.method2

	where cut short-circuits the other methd calls if its receiver
	is nil. Otherwise it returns its receiver, passing it on for 
	the subsequent methods.

	Then nil.cut would be like failure in Icon, the rest of the
	statement is not executed, but nobody gets upset about it.

	I think cut is the wrong name because cut is complelely different
	in prolog, IIRC, and it doesn't look like an operator. <!> might
	look like a conditional cutting action....

	Hugh
	hgs@dmu.ac.uk


In This Thread