[#99426] [Ruby master Bug#17098] Float#negative? reports negative zero as not negative — chris@...

Issue #17098 has been reported by chrisseaton (Chris Seaton).

12 messages 2020/08/01

[#99449] [Ruby master Bug#17100] Ractor: a proposal for new concurrent abstraction without thread-safety issues — ko1@...

Issue #17100 has been reported by ko1 (Koichi Sasada).

41 messages 2020/08/03

[#99474] [Ruby master Feature#17103] Add a :since option to ObjectSpace.dump_all — jean.boussier@...

Issue #17103 has been reported by byroot (Jean Boussier).

9 messages 2020/08/04

[#99485] [Ruby master Misc#17104] Why are interpolated string literals frozen? — bughitgithub@...

Issue #17104 has been reported by bughit (bug hit).

23 messages 2020/08/05

[#99499] [Ruby master Bug#17105] A single `return` can return to two different places in a proc inside a lambda inside a method — eregontp@...

Issue #17105 has been reported by Eregon (Benoit Daloze).

10 messages 2020/08/06

[#99582] [Ruby master Feature#17122] Add category to Warning#warn — eileencodes@...

Issue #17122 has been reported by eileencodes (Eileen Uchitelle).

20 messages 2020/08/13

[#99700] [Ruby master Bug#17129] bundle install `eventmachine` and `sassc` fails since 914b2208ab3eddec478cdc3e079e6c30d0f0892c — yasuo.honda@...

Issue #17129 has been reported by yahonda (Yasuo Honda).

9 messages 2020/08/26

[ruby-core:99789] [Ruby master Feature#16746] Endless method definition

From: mame@...
Date: 2020-08-31 08:19:15 UTC
List: ruby-core #99789
Issue #16746 has been updated by mame (Yusuke Endoh).


In the previous dev-meeting, matz said that it should be prohibited to define setter method with endless definition.

```ruby
# prohibited
def foo=(x) = @x = x
```

There are two reasons:

1. This code is very confusing and it is not supposed that a destructive operation is defined in this style.
2. We want to allow `def foo=42` as `def foo() = 42` in future. It is difficult to implement it in short term, though. If `def foo=(x) = @x = x` is allowed once, it will become more difficult.

I will create a PR soon.

----------------------------------------
Feature #16746: Endless method definition
https://bugs.ruby-lang.org/issues/16746#change-87305

* 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:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread