Hi --

On Wed, 13 Dec 2006, Ryan Williams wrote:

> Assignment methods are weird, and I wish they acted more like regular
> methods.  It seems like they could be, but the parser doesn't properly parse
> the usage.  Let me show you what I mean.
>
> Assignment methods can't take more than one argument:
...
> Assignment methods can't take blocks:
...
> You can't seem to replace the single required argument with a block:
...
> Though you can define these methods all you want, it seems as though the
> parser that does the syntactic sugaring at the call location makes some very
> narrow assumptions about the nature of the assignment method.  Is there any
> way around this?

I think the idea of an assignment method *is* rather narrow.  If you
have things like this:

   person.name = "David" { ...}

then the assignment-method syntacs and semantics have branched so far
away from those of assignments that you might as well do:

   person.set_name("David") { ... }

which would certainly be one way around it, though I like the look of
the equal-sign methods most of the time.


David

-- 
Q. What's a good holiday present for the serious Rails developer?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
    aka The Ruby book for Rails developers!
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)