Project

General

Profile

Actions

Feature #3922

closed

Syntax awkwardness

Added by Ragmaanir (Ragmaanir Anon) over 13 years ago. Updated about 12 years ago.

Status:
Rejected
Target version:
-
[ruby-core:32731]

Description

=begin
[code]
1 + (2; 1) #=> 2
puts(1; 2) #=> syntax error
puts((1; 2)) # like: puts 2
puts (3)*2 #=> 6
puts(3)*2 #=> nil-error
puts (1; 2) #=> syntax error
puts (1; 2)*3 #=> syntax error
puts ((1; 2))*3 # like: puts 6
[/code]

IMO this is awkward behavior (but maybe it is intended). I think the same results can be achieved with a newline instead of ';'.
=end

Actions #1

Updated by matz (Yukihiro Matsumoto) over 13 years ago

=begin
Hi,

In message "Re: [ruby-core:32731] [Ruby 1.9-Bug#3922][Open] Syntax awkwardness"
on Sat, 9 Oct 2010 22:39:10 +0900, Lasse Fabisch writes:

|[code]
|1 + (2; 1) #=> 2
|puts(1; 2) #=> syntax error
|puts((1; 2)) # like: puts 2
|puts (3)*2 #=> 6
|puts(3)*2 #=> nil-error
|puts (1; 2) #=> syntax error
|puts (1; 2)*3 #=> syntax error
|puts ((1; 2))*3 # like: puts 6
|[/code]
|
|IMO this is awkward behavior (but maybe it is intended). I think the same results can be achieved with a newline instead of ';'.

It's intended. Do you have any proposal of 'non-awkward' syntax?

						matz.

=end

Actions #2

Updated by matz (Yukihiro Matsumoto) over 13 years ago

  • Category changed from YARV to core
  • Status changed from Open to Feedback
  • Assignee changed from ko1 (Koichi Sasada) to matz (Yukihiro Matsumoto)

=begin

=end

Actions #3

Updated by Ragmaanir (Ragmaanir Anon) over 13 years ago

=begin
Ok, first i was surprised by the fact that it is possible to embed
multiple statements inside a parenthesised expression:
[code]
(4; 1) #=> 1

OR:

(4

  1. #=> 1
    [/code]
    But ok, maybe this is needed somewhere (do you have an example? i could
    not come up with one yet).

This is what i think should not behave like it does:
[code]
puts (1; 2) # syntax error
[/code]
If im not mistaken the space in front of the parenthesis prevents that
the statement is interpreted as a parenthesized method call, so the (1; 2) should be interpreted as an expression. But then, why does it raise
an error?

=end

Actions #4

Updated by ko1 (Koichi Sasada) almost 13 years ago

  • Tracker changed from Bug to Feature

Updated by kosaki (Motohiro KOSAKI) about 12 years ago

  • Status changed from Feedback to Rejected

no progress very long time.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0