Afficher un message
Vieux 27/02/2008, 06h38   #11
Chad Perrin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Sun, Feb 24, 2008 at 05:59:46AM +0900, Martin DeMello wrote:
> On Sat, Feb 23, 2008 at 3:44 AM, Robert Dober <robert.dober@gmail.com> wrote:
> >
> > Nice work Martin, I suggest however that you do a
> > gsub("function","method") on your text, there are just no functions in
> > Ruby.
> > What do you think?

>
> I did think about that, and deliberately decided to go with
> 'function', since from a newbie perspective toplevel methods *are*
> functions.
>
> Pros: Clear, conceptually simple to understand, a useful and
> for-the-moment accurate model of what's happening
> Cons: Technically incorrect, but to explain the difference would delve
> into ruby's object model a bit too soon.


There's a middle road: Mention briefly that they're called "methods",
even if they fill the same role as "functions" in many other languages,
and leave it at that.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
W. Somerset Maugham: "The ability to quote is a serviceable substitute for
wit."

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