Glenn Smith
4/6/2005 8:48:00 PM
The def method(params) is the style used in many commonly used
languages, such as 'C' and variants, 'VB' and so-on. So this style is
natural to me.
I think one of the attractions of Ruby is it's friendly looking
syntax. ie. a newcomer takes a look at a bit of ruby and thinks "hey,
that doesn't look too hard" and digs deeper.
Whereas if you take a look at, for example, Smalltalk, which (IMO)
looks a bit weird if you don't know how to read it, then this can be
quite offputting to newcomers.
Just my pointless 2 pence/cents/euros/sheckles worth.
On Apr 6, 2005 3:23 PM, David A. Black <dblack@wobblini.net> wrote:
> Hi --
>
> On Wed, 6 Apr 2005, Douglas Livingstone wrote:
>
> > On Apr 6, 2005 4:11 AM, Daniel Amelang <daniel.amelang@gmail.com> wrote:
> >>> As for the first. Why not "do (a,b) ... end" instead of "do |a,b| ...
> >>> end" Well, without thinking about it to much, I imagine it is simply
> >>> due to syntax ambiguities.
> >>
> >> I've wondered about this one before. It would be _possible_ to change
> >> the method definition to use pipes instead of parans, and not have
> >> ambiguities (I think), but that's a pretty significant language
> >> change. I guess they were just born that way, and it's too late to
> >> change.
> >
> > So these two would be the same, right?
> >
> > def myfunc(foo = nil, bar = nil)
> > end
> >
> > def myfunc |foo, bar|
> > end
>
> Hopefully it would be one or the other (the second only if there were
> some huge unification going on where parens were eliminated for method
> definitions).
>
> David
>
> --
> David A. Black
> dblack@wobblini.net
>
>
--
All the best
Glenn
Aylesbury, UK