[#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:04263] Re: Method signature - a question for the group

From: Dave Thomas <Dave@...>
Date: 2000-07-29 00:19:26 UTC
List: ruby-talk #4263
Conrad Schneiker <schneik@austin.ibm.com> writes:

> On: http://dev.rubycentral.com/ref/ref_c_string.html#upcase!
> 
> I noticed:
> 
>     str.rindex( aString [, aFixnum] ) -> aFixnum or nil{
>     str.rindex( aFixnum [, aFixnum] ) -> aFixnum or nil{

Oops - I guess Matz forgot to announce this.

As of 1.5.5, Ruby introduces a new and unique feature---reality-based
constants. Easily identified by their suffix of '{' (intended to
remind the reader of an anchor which holds the constant in place)
reality-based constants are unique in that their value is
automatically and inextricably bound to the underlying universe. The
constant 'nil{', for example, is synonymous with nothingness, an empty
void. 'nil{' is different from the old constant 'nil', in that it can
on occasion spontaneously generate a 'true' and a 'false'.

Other interesting RBCs include Math::PI{. If you execute

   Math::PI{ = 4

all circles in the universe become square. The new manual has a
sidebar which advises users with laptops not to do this while flying
or otherwise traveling.

Sick of things rolling off your desk?

   PhysicalConstants::G{ = 0

should do the trick. Now anyone can determine the fate of the universe 
by setting Hubble's constant. If you have to go to the bathroom in the 
middle of a movie, set the speed of light to an inch per year, then
reset it when you get back. You won't miss a thing.

I think we can all agree that this is a unique and immensely useful
new feature, which is worth a slight syntactic inconvenience.



Regards


Dave


In This Thread