Afficher un message
Vieux 22/02/2008, 01h53   #5
Gary Wright
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to define the assignment operator in Ruby ?


On Feb 21, 2008, at 9:10 AM, Ilan Berci wrote:
> In ruby, we don't assign to an instance as you mentioned, we assign
> to a
> variable that can hold any type. We therefore can't override the
> assignment operator.
>
> BUT you can override an assignment operation.. such as


Setter methods may look like assignment, but semantically they are
method calls. I think it just confuses matters to call setter method
invocation an 'assignment operation'.

The desire to override assignment or define an assignment operator is
generally indicative of some misunderstanding regarding Ruby's object
model.

Gary Wright

  Réponse avec citation
 
Page generated in 0,04512 seconds with 9 queries