[#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:03969] Re: Are named formal parameters in recent ruby interpreters?

From: Dave Thomas <Dave@...>
Date: 2000-07-13 11:50:49 UTC
List: ruby-talk #3969
Robert Feldt <feldt@ce.chalmers.se> writes:

> I picked up the lines:
> > 		new_img = TkPhotoImage.new('file'=> filename)
> > 		image_widget.copy(new_img, 'subsample' => "8 8")
> > 
> in a previous post by Andy Hunt. So I guess "name-wise" method formal
> parameters (I don't recall the correct name for X.new('file' => filename)
> type of parameter assigment) is now in Ruby. Is this in the 1.5 revision
> chain? Any docs or examples on how to use this?

Unfortunately they're not there yet. What you're seeing here is a
feature of Ruby method calling: if the last parameter to a method is a 
Hash literal, you can leave off the {}'s

    copy(new_img, 'subsample' => [8,8], 'gamma' => 1.3)

is just shorthand for

    copy(new_img, { 'subsample' => [8,8], 'gamma' => 1.3 } )


Regards


Dave

In This Thread

Prev Next