Hacker News new | past | comments | ask | show | jobs | submit login

As a comparison, in Ruby

  puts "a" "b" == "ab" # true
and

  puts "a"
    "b" == "ab"
prints "a" with "b" == "ab" evaluated to false and discarded. This could create bugs as with Python. However

  ["a"
     "b"] == ["ab"]
is syntax error at the beginning of the second line. The parser expects a ] It would evaluate to true if it were on one line.



In Ruby one too many commas can also cause problems:

# list

list = "a","b",

# function

def foobar

end

=> ["a", "b", :foobar]


I actually prefer Python approach here in that within () [] {} newlines are simply whitespace with no special meaning - this allows for very flexible formatting of expressions which is still unambiguous.

The implicit concat of string literals is the culprit here. It really should require "+".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: