# Syntax "surprise"

**URL:** <https://rubytalk.org/t/syntax-surprise/723>\
**Category:** ruby-talk\
**Created:** [17 July 2002 14:48 UTC](https://rubytalk.org/t/syntax-surprise/723 "2002-07-17T14:48:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Douthitt](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@David\_Douthitt](https://rubytalk.org/u/David_Douthitt)\
**Post date:** [17 July 2002 14:48 UTC](https://rubytalk.org/t/syntax-surprise/723/1 "2002-07-17T14:48:54Z")

</div>

I don’t know if this qualifies as a real “surprise”, but it was to me. I had thought this syntax would work:

opts = GetoptLong.new(  
[“–verbose”, “-v”, GetoptLong::NO\_ARGUMENT],  
[“–yesterday”, “-y”, GetoptLong::NO\_ARGUMENT],  
)

Now that fails… but the following works:

opts = GetoptLong.new(  
[“–verbose”, “-v”, GetoptLong::NO\_ARGUMENT],  
[“–yesterday”, “-y”, GetoptLong::NO\_ARGUMENT]  
)

It’s the one solitary COMMA at the end that did it. I remember reading in my Perl books that they allow the oddity of an extra comma at the end so one can cut and paste over and over and not have to strip that extra annoying comma. I thought Ruby did that, but not here…

Why not?

David Douthitt  
CUNA & Affiliates  
UNIX Systems Administrator  
[ddouthitt@cuna.coop](mailto:ddouthitt@cuna.coop)

---

<div class="post-metadata">

**Author:** ![Kent\_Dahl2](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@Kent\_Dahl2](https://rubytalk.org/u/Kent_Dahl2)\
**Post date:** [17 July 2002 15:28 UTC](https://rubytalk.org/t/syntax-surprise/723/2 "2002-07-17T15:28:05Z")

</div>

David Douthitt wrote:

> opts = GetoptLong.new(  
> [“–verbose”, “-v”, GetoptLong::NO\_ARGUMENT],  
> [“–yesterday”, “-y”, GetoptLong::NO\_ARGUMENT],  
> )
> 
> Now that fails…

Ugly workaround using array expansion:  
opts = GetoptLong.new(\*[  
[“–verbose”, “-v”, GetoptLong::NO\_ARGUMENT],  
[“–yesterday”, “-y”, GetoptLong::NO\_ARGUMENT],  
])

But I’d have to argue against allowing trailing commas in method calls  
(and definitions), on the basis that it could make it easier to write  
methods that take a lot of parameters. IIRC, a large number of  
parameters to a method is a “code smell”, and allowing the trailing  
comma would be like spraying some fresh pine scent on it to cover it…  
IMHO.

> **···**
>
> –  
> ([Kent Dahl]/)\_ _~_**[[http://www.stud.ntnu.no/~kentda/](http://www.stud.ntnu.no/~kentda/) ]**_/~  
> ))\_student_/(( \__d L b_\_/ NTNU - graduate engineering - 4. year )  
> ( \__\_õ|õ_/**/ ) _)Industrial economics and technological management(  
> \__**/_ö_\_\_\_\_/ (\_**_engineering.discipline_=_Computer::Technology_**)

---

<div class="post-metadata">

**Author:** ![Dave\_Thomas](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@Dave\_Thomas](https://rubytalk.org/u/Dave_Thomas)\
**Post date:** [17 July 2002 15:42 UTC](https://rubytalk.org/t/syntax-surprise/723/3 "2002-07-17T15:42:58Z")

</div>

Kent Dahl [kentda@stud.ntnu.no](mailto:kentda@stud.ntnu.no) writes:

> But I’d have to argue against allowing trailing commas in method calls  
> (and definitions), on the basis that it could make it easier to write  
> methods that take a lot of parameters. IIRC, a large number of  
> parameters to a method is a “code smell”, and allowing the trailing  
> comma would be like spraying some fresh pine scent on it to cover it…  
> IMHO.

There’s also an ambiguity:

do\_something 1,2,3,  
puts “done”

Do we call do\_something with 3 parameters, or pass the nil result from  
puts as well? You’d only be able to have trailing commas with  
parenthesized parameter lists.

Cheers

Dave

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [17 July 2002 15:44 UTC](https://rubytalk.org/t/syntax-surprise/723/4 "2002-07-17T15:44:12Z")

</div>

Hi,

> Ugly workaround using array expansion:  
> opts = GetoptLong.new(\*[  
> [“–verbose”, “-v”, GetoptLong::NO\_ARGUMENT],  
> [“–yesterday”, “-y”, GetoptLong::NO\_ARGUMENT],  
> ])

Wow, I was just writing the same workaround. You’re a mind reader.

> But I’d have to argue against allowing trailing commas in method calls  
> (and definitions), on the basis that it could make it easier to write  
> methods that take a lot of parameters. IIRC, a large number of  
> parameters to a method is a “code smell”, and allowing the trailing  
> comma would be like spraying some fresh pine scent on it to cover it…

Wow, in fact, it used to accept trailing comma in argument list, but I  
removed that syntax rule for the reason you described here.

```
						matz.

```

> **···**
>
> In message “Re: Syntax “surprise”” on 02/07/18, Kent Dahl [kentda@stud.ntnu.no](mailto:kentda@stud.ntnu.no) writes:

---

<div class="post-metadata">

**Author:** ![Jeremy\_Henty](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@Jeremy\_Henty](https://rubytalk.org/u/Jeremy_Henty)\
**Post date:** [17 July 2002 17:48 UTC](https://rubytalk.org/t/syntax-surprise/723/5 "2002-07-17T17:48:35Z")

</div>

Much as I love Ruby over Perl, this is one feature of Perl that I  
thought was great and I wish Ruby copied it. It makes it easier  
eg. to swap arguments around if you realise the order is wrong. So in  
some ways this feature makes it _easier_ to get your code smelling  
sweet.

Regards,

Jeremy Henty

> **···**
>
> In article [3D358854.2E032977@stud.ntnu.no](mailto:3D358854.2E032977@stud.ntnu.no), Kent Dahl wrote:
> 
> > … I’d have to argue against allowing trailing commas in method  
> > calls (and definitions), on the basis that it could make it easier  
> > to write methods that take a lot of parameters.

---

<div class="post-metadata">

**Author:** ![ts1](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@ts1](https://rubytalk.org/u/ts1)\
**Post date:** [17 July 2002 15:49 UTC](https://rubytalk.org/t/syntax-surprise/723/6 "2002-07-17T15:49:30Z")

</div>

> &nbsp;&nbsp;&nbsp;do\_something 1,2,3,  
> &nbsp;&nbsp;&nbsp;puts "done"

pigeon% ruby  
def do\_something(\*arg)  
&nbsp;&nbsp;&nbsp;p arg  
end

do\_something 1,2,3,  
puts "done"  
^D  
done  
[1, 2, 3, nil]  
pigeon%

pigeon% ruby -v  
ruby 1.6.7 (2002-03-01) [i686-linux]  
pigeon%

For the original message, this is a difference 1.4 / 1.6

Guy Decoux

---

<div class="post-metadata">

**Author:** ![Brad\_Cox](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@Brad\_Cox](https://rubytalk.org/u/Brad_Cox)\
**Post date:** [17 July 2002 16:39 UTC](https://rubytalk.org/t/syntax-surprise/723/7 "2002-07-17T16:39:38Z")

</div>

Still, its a shame ruby adopts the same shortcoming as java.

Its not a language’s business to prevent users from writing “smelly” code.

Long argument lists are common in data initialization contexts, and  
misplaced commas a extremely common problem, that’s actively  
manufactured by this rule.

```
@@instance = SomeClass.new(
	"127.0.0.1",
	8083,
	"hostname.com",
	blah,
	blah,
	whoops,
);

```

> **···**
>
> At 12:44 AM +0900 7/18/02, Yukihiro Matsumoto wrote:
> 
> > Hi,
> > 
> > In message “Re: Syntax “surprise”” \> on 02/07/18, Kent Dahl [kentda@stud.ntnu.no](mailto:kentda@stud.ntnu.no) writes:
> > 
> > > Ugly workaround using array expansion:  
> > > opts = GetoptLong.new(\*[  
> > > [“–verbose”, “-v”, GetoptLong::NO\_ARGUMENT],  
> > > [“–yesterday”, “-y”, GetoptLong::NO\_ARGUMENT],  
> > > ])
> > 
> > Wow, I was just writing the same workaround. You’re a mind reader.
> > 
> > > But I’d have to argue against allowing trailing commas in method calls  
> > > (and definitions), on the basis that it could make it easier to write  
> > > methods that take a lot of parameters. IIRC, a large number of  
> > > parameters to a method is a “code smell”, and allowing the trailing  
> > > comma would be like spraying some fresh pine scent on it to cover it…
> > 
> > Wow, in fact, it used to accept trailing comma in argument list, but I  
> > removed that syntax rule for the reason you described here.
> > 
> > ```
> > matz.
> > 
> > ```
> 
> –  
> Brad Cox, PhD; bcox@virtualschool.edu 703 361 4751  
> o For industrial age goods there were checks and credit cards.  
> For everything else there is [http://virtualschool.edu/mybank](http://virtualschool.edu/mybank)  
> o Interactive Learning Environment [http://virtualschool.edu/ile](http://virtualschool.edu/ile)  
> o Java Web Application Architecture: [http://virtualschool.edu/jwaa](http://virtualschool.edu/jwaa)

---

<div class="post-metadata">

**Author:** ![Dossy](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dossy](https://rubytalk.org/u/Dossy)\
**Post date:** [17 July 2002 18:06 UTC](https://rubytalk.org/t/syntax-surprise/723/8 "2002-07-17T18:06:33Z")

</div>

report.define(0, {  
:column =\> ‘ABC’,  
:label =\> ‘ABC\_D’,  
:width =\> -5,  
})

This is an actual code snippet from a test case of mine.

– Dossy

> **···**
>
> On 2002.07.18, Jeremy Henty [jeremy@chaos.org.uk](mailto:jeremy@chaos.org.uk) wrote:
> 
> > In article [3D358854.2E032977@stud.ntnu.no](mailto:3D358854.2E032977@stud.ntnu.no), Kent Dahl wrote:
> > 
> > > … I’d have to argue against allowing trailing commas in method  
> > > calls (and definitions), on the basis that it could make it easier  
> > > to write methods that take a lot of parameters.
> > 
> > Much as I love Ruby over Perl, this is one feature of Perl that I  
> > thought was great and I wish Ruby copied it. It makes it easier  
> > eg. to swap arguments around if you realise the order is wrong. So in  
> > some ways this feature makes it _easier_ to get your code smelling  
> > sweet.
> 
> –  
> Dossy Shiobara mail: [dossy@panoptic.com](mailto:dossy@panoptic.com)  
> Panoptic Computer Network web: [http://www.panoptic.com/](http://www.panoptic.com/)  
> “He realized the fastest way to change is to laugh at your own  
> folly – then you can let go and quickly move on.” (p. 70)

---

<div class="post-metadata">

**Author:** ![Harry\_Ohlsen2](https://avatars.discourse-cdn.com/v4/letter/h/958977/32.png) [@Harry\_Ohlsen2](https://rubytalk.org/u/Harry_Ohlsen2)\
**Post date:** [17 July 2002 20:58 UTC](https://rubytalk.org/t/syntax-surprise/723/9 "2002-07-17T20:58:21Z")

</div>

> Much as I love Ruby over Perl, this is one feature of Perl that I  
> thought was great and I wish Ruby copied it. It makes it easier  
> eg. to swap arguments around if you realise the order is wrong.

Nah. Maybe I’m a masochist, but I reckon if you do something stupid, it  
should be HARD to fix, so you remember and don’t do it next time … or at  
least the time after that :-).

---

<div class="post-metadata">

**Author:** ![Dave\_Thomas](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@Dave\_Thomas](https://rubytalk.org/u/Dave_Thomas)\
**Post date:** [17 July 2002 16:01 UTC](https://rubytalk.org/t/syntax-surprise/723/10 "2002-07-17T16:01:36Z")

</div>

ts [decoux@moulon.inra.fr](mailto:decoux@moulon.inra.fr) writes:

> do\_something 1,2,3,  
> puts “done”  
> ^D  
> done  
> [1, 2, 3, nil]

Agreed - the poster though was asking for trailing commas to be  
permitted in argument lists

do\_somthing(1,2,3,)

would be a call with three parameters. I was suggesting that if this  
was allowed, it could only work if the parameter list was  
parenthesized, as there would otherwise be the ambiguity shown above.

Dave

---

<div class="post-metadata">

**Author:** ![Dossy](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dossy](https://rubytalk.org/u/Dossy)\
**Post date:** [17 July 2002 17:07 UTC](https://rubytalk.org/t/syntax-surprise/723/11 "2002-07-17T17:07:24Z")

</div>

> Its not a language’s business to prevent users from writing “smelly” code.

Um, right. When you believe this, you end up with Perl.

I love Perl dearly, but there’s a reason why I’ve stopped doing any  
new development in Perl and everything in Ruby now. I don’t think  
a language should constrain you from being able to do things, but I  
don’t feel constrained by Ruby _at all_. If the constraints keep  
people from writing smelly code – which I may, some day, have to  
interface with, read, understand, change or modify – but the  
constraints don’t feel constraining _to me_ … I can only see that  
as a Very Good Thing.

> Long argument lists are common in data initialization contexts,

Bad code is common. You’re very right.

I recently took an #initialize in a class that took 5 args  
(4 Arrays and one Hash) and refactored it a few times so that  
the constructor only took one Array of Hashes (to be specific,  
all of the DBI::Row objects for the result set of a SQL query  
via DBI).

Then, I added methods to the class to set the various other  
attributes – anything “unset” got a sane default value, so  
I only had to “override” things that needed to be changed,  
as to explicitly setting them in the other 4 Array args as  
I was doing before.

The design is much cleaner, certainly easier to read and  
understand and is far less smelly. It’s still smelly (there’s  
a strong feeling of duplication that I’m trying to eliminate)  
and I think it’s time to introduce polymorphism or someother  
such refactoring soon, but I’ll do that when I write the next  
test case that feels difficult to implement because of the  
way things currently are.

> and misplaced commas a extremely common problem, that’s actively  
> manufactured by this rule.

Yes, and misplaced commas are more often a mistake than an  
intention. So, I prefer the language to at least warn me  
that I’ve done it – making it a fatal error isn’t a big deal,  
anyway.

How hard is it to find a misplaced comma when the program won’t  
even run because of it? Trivially easy to find.

How hard is it to track down a bug _because_ of a misplaced comma  
which the language finds perfectly acceptable and within the rules?  
Pretty damn near impossible sometimes, especially if you’re tired.

If you’re really desperate for having “optional trailing commas”  
the Array expansion trick described earlier in the thread gives  
it to you with no change to the language itself. Wrapping the  
arg. list in \* is a way to express the intentional desire to  
support an optional trailing comma which is good. Having that  
behavior by default is too magical and will only cause more harm  
than good when people make honest mistakes.

– Dossy

> **···**
>
> On 2002.07.18, Brad Cox [bcox@virtualschool.edu](mailto:bcox@virtualschool.edu) wrote:
> 
> –  
> Dossy Shiobara mail: [dossy@panoptic.com](mailto:dossy@panoptic.com)  
> Panoptic Computer Network web: [http://www.panoptic.com/](http://www.panoptic.com/)  
> “He realized the fastest way to change is to laugh at your own  
> folly – then you can let go and quickly move on.” (p. 70)

---

<div class="post-metadata">

**Author:** ![Tim\_Hunter3](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@Tim\_Hunter3](https://rubytalk.org/u/Tim_Hunter3)\
**Post date:** [17 July 2002 17:48 UTC](https://rubytalk.org/t/syntax-surprise/723/12 "2002-07-17T17:48:27Z")

</div>

C allows a trailing comma in initializers:

int foo = {1,2,3,};

The justification (iirc) was that it made it easier to write programs  
that generate C language statements.

> **···**
>
> On Wed, 17 Jul 2002 16:42:09 GMT, Brad Cox [bcox@virtualschool.edu](mailto:bcox@virtualschool.edu) wrote:
> 
> > Still, its a shame ruby adopts the same shortcoming as java.
> > 
> > Its not a language’s business to prevent users from writing “smelly” code.
> > 
> > Long argument lists are common in data initialization contexts, and  
> > misplaced commas a extremely common problem, that’s actively  
> > manufactured by this rule.
> > 
> > @@instance = SomeClass.new(  
> > “127.0.0.1”,  
> > 8083,  
> > “[hostname.com](http://hostname.com)”,  
> > blah,  
> > blah,  
> > whoops,  
> > );

---

<div class="post-metadata">

**Author:** ![Kent\_Dahl2](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@Kent\_Dahl2](https://rubytalk.org/u/Kent_Dahl2)\
**Post date:** [17 July 2002 17:48 UTC](https://rubytalk.org/t/syntax-surprise/723/13 "2002-07-17T17:48:29Z")

</div>

Brad Cox wrote:

> Its not a language’s business to prevent users from writing “smelly” code.

I strongly disagree. Improvements in structure that higher-level  
languages bring along have for the most part been about removing the  
need for “smelly” code. (Ok, so perhaps goto wasn’t referred to as  
“smelly”, but it stank nonetheless)

In the extreme case of this, I even like Java for its sandboxing  
capabilities. No, not the security-wise ones, but the sandbox and  
confindments that novice programmers can wallop around in like newborn  
babies, but still enforce some structure (such as only one public class  
per sourcefile etc). Sure, Ruby is alot more pragmatic, practical and  
lax, but think you’re talking perlish pragmatism here. 🙂

> Long argument lists are common in data initialization contexts, and  
> misplaced commas a extremely common problem, that’s actively  
> manufactured by this rule.

I find long argument lists to be an abomination. A problem I fall into  
much more frequently than missing a comma, is ordering and remembering  
them all. The current way Ruby automagically makes a hash at the end may  
not be the best solution, but I have spent more time on stupid mistakes  
using libraries with many arguments (that didn’t allow the hash variant)  
than I do on finding back to the parse error of a missing comma, which  
tends to be pretty accurately pointed out. (And no, the parse error  
won’t be lingering for a long time before it rears its ugly head if you  
have thorough unittests.)

I’d also dare to go out on a bit of an extreme limb as to claim that the  
non-keyword comma separation of arguments is a fundamental flaw of many  
programming languages, for there is no linear, sequential structure at  
work here, like with arrays(for which comma trailing is allowed). The  
linearity is a throwback to compiler-feeding.

On the other hand, I’m also not fond of the “creative” diversity that  
keyword arguments bring, where the ordering is completetly up to the  
programmer. The possibility of leaving out optional parameters in the  
middle of the argument list is neat. Perhaps it is false to say that  
there is no linear structure in a method call. It might be closer to the  
truth to claim that the argument list linearity often fails to map to  
the “storytelling” linearity when there is alot of arguments. I’m not a  
SmallTalker but here I think SmallTalk was onto something, with a  
defined order of keywords that both separate and describe the arguments,  
making a very readable story.

I can’t say the same for:

> ```
> @@instance = SomeClass.new(
> "127.0.0.1",
> 8083,
> "hostname.com",
> blah,
> blah,
> whoops,
> );
> 
> ```

I just love how Ruby does the Right Thing in alot of cases here, (such  
as File.open which is more readable than File.new) but it doesn’t  
currently extend into argument lists. When keyword argument design is  
finalized, I prophetize it will.

(I cut this rant short here, as Dossy posted a reply that has the  
remainder of what I had on mind, but alot shorter and neater than I  
could write it.)

> **···**
>
> –  
> ([Kent Dahl]/)\_ _~_**[[http://www.stud.ntnu.no/~kentda/](http://www.stud.ntnu.no/~kentda/) ]**_/~  
> ))\_student_/(( \__d L b_\_/ NTNU - graduate engineering - 4. year )  
> ( \__\_õ|õ_/**/ ) _)Industrial economics and technological management(  
> \__**/_ö_\_\_\_\_/ (\_**_engineering.discipline_=_Computer::Technology_**)

---

<div class="post-metadata">

**Author:** ![Christopher\_Browne](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@Christopher\_Browne](https://rubytalk.org/u/Christopher_Browne)\
**Post date:** [17 July 2002 17:48 UTC](https://rubytalk.org/t/syntax-surprise/723/14 "2002-07-17T17:48:32Z")

</div>

Oops! Brad Cox [bcox@virtualschool.edu](mailto:bcox@virtualschool.edu) was seen spray-painting on a wall:

> Still, its a shame ruby adopts the same shortcoming as java.
> 
> Its not a language’s business to prevent users from writing “smelly” code.
> 
> Long argument lists are common in data initialization contexts, and  
> misplaced commas a extremely common problem, that’s actively  
> manufactured by this rule.
> 
> @@instance = SomeClass.new(  
> “127.0.0.1”,  
> 8083,  
> “[hostname.com](http://hostname.com)”,  
> blah,  
> blah,  
> whoops,  
> );

If you have a procedure with ten parameters, you probably missed some.  
– Alan J. Perlis

Common Lisp’s :key parameters (that can have defaults) are an  
interesting approach to the problem.

I seem to recall Objective C having a pretty nice approach to it,  
too. (Somehow your name tickles some memories concerning ObjC… You  
didn’t have some involvement with it, did you?)

If there are THAT many parameters, I think it’s _critical_ for them to  
be named otherwise it starts being a bit like programming in Morse  
Code, Dit-Dah-Dah-Dah Dit Dah-Dit, with lots of risk of pieces getting  
out of sorts.

And at that point, Perlis isn’t just right, he’s ferociously right…

> **···**
>
> –  
> (concatenate 'string “cbbrowne” “@ntlug.org”)  
> [http://www3.sympatico.ca/cbbrowne/languages.html](http://www3.sympatico.ca/cbbrowne/languages.html)  
> Rules of the Evil Overlord #44. “I will only employ bounty hunters who  
> work for money. Those who work for the pleasure of the hunt tend to do  
> dumb things like even the odds to give the other guy a sporting  
> chance.” [http://www.eviloverlord.com/](http://www.eviloverlord.com/)

---

<div class="post-metadata">

**Author:** ![Jeremy\_Henty](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@Jeremy\_Henty](https://rubytalk.org/u/Jeremy_Henty)\
**Post date:** [18 July 2002 08:09 UTC](https://rubytalk.org/t/syntax-surprise/723/15 "2002-07-18T08:09:22Z")

</div>

Well, I’m something of a perfectionist, so I don’t _need_ the language  
to punish me for stupidity. I do that perfectly well myself. 🙂  
More seriously, not all mistakes are stupid. Something that makes it  
hard for me to correct my mistake is stopping me from going on to  
making the next mistake and learning even more.

Regards,

Jeremy

> **···**
>
> In article [200207180658.12096.harryo@zip.com.au](mailto:200207180658.12096.harryo@zip.com.au), Harry Ohlsen wrote:
> 
> > [Jeremy Henty wrote:]
> > 
> > > Much as I love Ruby over Perl, this is one feature of Perl that I  
> > > thought was great and I wish Ruby copied it. It makes it easier  
> > > eg. to swap arguments around if you realise the order is wrong.
> > 
> > Nah. Maybe I’m a masochist, but I reckon if you do something stupid, it  
> > should be HARD to fix, so you remember and don’t do it next time … or at  
> > least the time after that :-).

---

<div class="post-metadata">

**Author:** ![Jeremy\_Henty](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@Jeremy\_Henty](https://rubytalk.org/u/Jeremy_Henty)\
**Post date:** [18 July 2002 08:09 UTC](https://rubytalk.org/t/syntax-surprise/723/16 "2002-07-18T08:09:24Z")

</div>

Neat! I’ll keep in mind when I next hit this issue.

Jeremy

> **···**
>
> In article [20020717180630.GJ5537@panoptic.com](mailto:20020717180630.GJ5537@panoptic.com), Dossy wrote:
> 
> > On 2002.07.18, Jeremy Henty [jeremy@chaos.org.uk](mailto:jeremy@chaos.org.uk) wrote:
> > 
> > > In article [3D358854.2E032977@stud.ntnu.no](mailto:3D358854.2E032977@stud.ntnu.no), Kent Dahl wrote:
> > > 
> > > > … I’d have to argue against allowing trailing commas in method  
> > > > calls …
> > > 
> > > … It makes it easier eg. to swap arguments around if you realise  
> > > the order is wrong. So in some ways this feature makes it _easier_  
> > > to get your code smelling sweet.
> > 
> > report.define(0, {  
> > :column =\> ‘ABC’,  
> > :label =\> ‘ABC\_D’,  
> > :width =\> -5,  
> > })

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [22 July 2002 13:50 UTC](https://rubytalk.org/t/syntax-surprise/723/17 "2002-07-22T13:50:42Z")

</div>

Hi,

> **···**
>
> In message “Re: Syntax “surprise”” on 02/07/18, Brad Cox [bcox@virtualschool.edu](mailto:bcox@virtualschool.edu) writes:
> 
> > Its not a language’s business to prevent users from writing “smelly” code.
> 
> Despite I agree with this principle most of the cases, I’m not sure  
> whether allowing trailing comma in argument list enhance / reduce  
> astonishment, considering most of popular languages (except Perl) does  
> not allow trailing comma.
> 
> ```
> matz.
> 
> ```

---

<div class="post-metadata">

**Author:** ![Brad\_Cox](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@Brad\_Cox](https://rubytalk.org/u/Brad_Cox)\
**Post date:** [17 July 2002 18:29 UTC](https://rubytalk.org/t/syntax-surprise/723/18 "2002-07-17T18:29:43Z")

</div>

Yep, quite a bit.

Didn’t mention keywords because that’s really the best tool for this  
job, but unsupported in ruby. When that’s fixed I’ll withdraw my  
objection.

> **···**
>
> At 2:48 AM +0900 7/18/02, Christopher Browne wrote:
> 
> > I seem to recall Objective C having a pretty nice approach to it,  
> > too. (Somehow your name tickles some memories concerning ObjC… You  
> > didn’t have some involvement with it, did you?)
> 
> –  
> Brad Cox, PhD; bcox@virtualschool.edu 703 361 4751  
> o For industrial age goods there were checks and credit cards.  
> For everything else there is [http://virtualschool.edu/mybank](http://virtualschool.edu/mybank)  
> o Interactive Learning Environment [http://virtualschool.edu/ile](http://virtualschool.edu/ile)  
> o Java Web Application Architecture: [http://virtualschool.edu/jwaa](http://virtualschool.edu/jwaa)

---

<div class="post-metadata">

**Author:** ![Ned\_Konz](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Ned\_Konz](https://rubytalk.org/u/Ned_Konz)\
**Post date:** [17 July 2002 19:32 UTC](https://rubytalk.org/t/syntax-surprise/723/19 "2002-07-17T19:32:38Z")

</div>

Brad Cox wrote Objective C.

> **···**
>
> On Wednesday 17 July 2002 10:48 am, Christopher Browne wrote:
> 
> > I seem to recall Objective C having a pretty nice approach to it,  
> > too. (Somehow your name tickles some memories concerning ObjC…  
> > You didn’t have some involvement with it, did you?)
> 
> –  
> Ned Konz  
> [http://bike-nomad.com](http://bike-nomad.com)  
> GPG key ID: BEEA7EFE

---

<div class="post-metadata">

**Author:** ![Mike4](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Mike4](https://rubytalk.org/u/Mike4)\
**Post date:** [23 July 2002 15:46 UTC](https://rubytalk.org/t/syntax-surprise/723/20 "2002-07-23T15:46:37Z")

</div>

Yukihiro Matsumoto wrote:

> > Its not a language’s business to prevent users from writing “smelly” code.
> 
> Despite I agree with this principle most of the cases, I’m not sure  
> whether allowing trailing comma in argument list enhance / reduce  
> astonishment, considering most of popular languages (except Perl) does  
> not allow trailing comma.

I agree that trailing commas are strange. A comma means something,  
to the language and to people who read a script in that language.  
A trailing comma means something is missing.

If I could raise a similar issue,  
I noticed this in the 1.6.7 TODO file:

- compile time string concatenation, “hello” “world” =\> “helloworld”

I know that some other popular languages like to do that,  
but I think it would be better to leave it as two arguments.  
After all, someone wrote those two literals separately on purpose.

I would even go so far as to make commas optional, if that is possible.  
(other popular languages use white-space delimiters: sh, Tcl, Lisp)  
There would be less symbol clutter, and the script might be easier  
to read.

```
obj.method a, b, c {|i| xyz}

```

vs  
obj.method a b c {|i| xyz}

```
obj.method "a", "b", "c"

```

vs  
obj.method “a” “b” “c”

Just something that would make Ruby even better, I think.

> **···**
>
> > In message “Re: Syntax “surprise”” \> on 02/07/18, Brad Cox [bcox@virtualschool.edu](mailto:bcox@virtualschool.edu) writes:
> 
> –  
> Mike Hall  
> [http://www.enteract.com/~mghall](http://www.enteract.com/~mghall)

[Next page](https://rubytalk.org/t/syntax-surprise/723.md?page=2)
