[#101179] Spectre Mitigations — Amel <amel.smajic@...>
Hi there!
5 messages
2020/12/01
[#101694] Ruby 3.0.0 Released — "NARUSE, Yui" <naruse@...>
V2UgYXJlIHBsZWFzZWQgdG8gYW5ub3VuY2UgdGhlIHJlbGVhc2Ugb2YgUnVieSAzLjAuMC4gRnJv
4 messages
2020/12/25
[ruby-core:101495] [Ruby master Bug#17398] SyntaxError in endless method
From:
zverok.offline@...
Date:
2020-12-17 09:39:19 UTC
List:
ruby-core #101495
Issue #17398 has been updated by zverok (Victor Shepelev).
@mame Hmm, haven't thought about it from this perspective... Can you please explain a bit? As far as I can see, in, say, assignment context it behaves like an expression:
```ruby
result = puts 'foo'
# prints "foo", result = nil
```
I am just trying to describe the behavior in full for the next installment of my [changelog](https://rubyreferences.github.io/rubychanges/) and this aspect is quite confusing for me... Though, it is not endless-method specific, as far as I can see:
```ruby
y = sin x # OK
y = 1 + sin x
# ^ unexpected local variable or method, expecting `do' or '{' or '('
```
What's the "rule of thumb" to understand this better?
----------------------------------------
Bug #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-89275
* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```
This does not:
```ruby
def foo() = puts "bar"
# ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```
Is this intentional or accidental? Not sure how it is reasoned.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>