[#101179] Spectre Mitigations — Amel <amel.smajic@...>
Hi there!
5 messages
2020/12/01
[#101180] Re: Spectre Mitigations
— Chris Seaton <chris@...>
2020/12/01
I wouldn’t recommend using Ruby to run in-process untrusted code in the first place. Are people doing that?
[#101694] Ruby 3.0.0 Released — "NARUSE, Yui" <naruse@...>
We are pleased to announce the release of Ruby 3.0.0. From 2015 we
4 messages
2020/12/25
[ruby-core:101808] [Ruby master Feature#16746] Endless method definition
From:
etienne.barrie@...
Date:
2020-12-29 20:49:09 UTC
List:
ruby-core #101808
Issue #16746 has been updated by etienne (部ienne Barri薊.
I haven't seen it mentioned in the comments so I just wanted to point out that the regular method-definition syntax doesn't require semicolons, and is very close to this experiment, given the parentheses are mandatory:
``` ruby
def fib(x) x < 2 ? x : fib(x-1) + fib(x-2) end
# one-line style
def value() @value end
# one-line style 3.0
def value() = @value
# one-line style setter
def value=(value) @value = value end
# not supported in 3.0
def value=(value) = @value = value
```
It doesn't remove the `end` which is the purpose of this feature sorry, but I like it because it keeps the consistency of having `end`, while not using more punctuation like `;` or `=`.
----------------------------------------
Feature #16746: Endless method definition
https://bugs.ruby-lang.org/issues/16746#change-89635
* Author: mame (Yusuke Endoh)
* Status: Closed
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
----------------------------------------
Ruby syntax is full of "end"s. I'm paranoid that the ends end Ruby. I hope Ruby is endless.
So, I'd like to propose a new method definition syntax.
```ruby
def: value(args) = expression
```
As you see, there is no "end".
Examples.
```ruby
def: hello(name) =
puts("Hello, #{ name }")
hello("endless Ruby") #=> Hello, endless Ruby
```
```ruby
def: inc(x) = x + 1
p inc(42) #=> 43
```
```ruby
x = Object.new
def: x.foo = "FOO"
p x.foo #=> "FOO"
```
```ruby
def: fib(x) =
x < 2 ? x : fib(x-1) + fib(x-2)
p fib(10) #=> 55
```
Limitations.
* `def: foo x = x` is invalid; the parentheses for formal arguments are mandatory.
* `private def: foo = x` is invalid; this method definition cannot be an method argument.
A patch is attached. No conflicts.
---Files--------------------------------
endless-method-definition.patch (2.47 KB)
--
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>