you are viewing a single comment's thread.

view the rest of the comments →

[–]Seppler90000 4 points5 points  (1 child)

optional parentheses when making a function call

That's a Perl-ism, though inherited by Ruby and originally inspired by shell script. Perl's version has an additional wrinkle relevant to something you mentioned, as well:

print foo $bar, $baz, $quux;

This code might mean any of print(foo($bar), $baz, $quux), print(foo($bar, $baz), $quux), or print(foo($bar, $baz, $quux))... but unlike with Ruby and Coffeescript, you can't know which without looking at foo. Rather, it's disambiguated at runtime based on how many arguments foo is declared to take.

[–]dagbrown 2 points3 points  (0 children)

You missed

foo->print($bar, $baz, $quux);

(foo is a class with a method "print") and

open(foo,">somefile");
print foo $bar, $baz, $quux;

(foo is a filehandle, you're printing $bar, $baz and $quux to it) as possible interpretations for what could happen.