From: mutantkeyboard@... Date: 2016-11-14T09:30:20+00:00 Subject: [ruby-core:78120] [Ruby trunk Bug#12929] ternary should look ahead w/in a block (and not care about newlines) Issue #12929 has been updated by Antonio Nesic. File Screen Shot 2016-11-14 at 10.24.39.png added ruby -v set to 2.3.1 Martin D��rst wrote: > In Ruby, all operators have to be written at the end of the line to make it possible to distinguish between complete statements (with a missing semicolon) and continuations. > > The only exception is the '.' operator, which is allowed to be on the next line to make method chaining look better, as follows: > > ``` > array.map ... > .select ... > .reject ... > .group ... > .sort ... > ``` > > What do you think is special about the ternary operator? I think that this is what he meant. If he uses IRB, then the syntax error comes up like: ~~~ ruby SyntaxError: (irb):14: syntax error, unexpected '?', expecting ')' from /Users/antonionesic/.rvm/rubies/ruby-2.3.1/bin/irb:11:in `
' ~~~ But I have to agree. This is a SyntaxError, and not a bug. Ticket should be closed. ---------------------------------------- Bug #12929: ternary should look ahead w/in a block (and not care about newlines) https://bugs.ruby-lang.org/issues/12929#change-61484 * Author: shawn wilson * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.3.1 * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- foo = (bar ? 0 : 1) # works foo = (bar ? 0 : 1) # works foo = (bar ? 0 : 1) # doesn't work ---Files-------------------------------- Screen Shot 2016-11-14 at 10.24.39.png (207 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: