[#86787] [Ruby trunk Feature#14723] [WIP] sleepy GC — ko1@...

Issue #14723 has been updated by ko1 (Koichi Sasada).

13 messages 2018/05/01
[#86790] Re: [Ruby trunk Feature#14723] [WIP] sleepy GC — Eric Wong <normalperson@...> 2018/05/01

ko1@atdot.net wrote:

[#87095] [Ruby trunk Feature#14767] [PATCH] gc.c: use monotonic counters for objspace_malloc_increase — ko1@...

Issue #14767 has been updated by ko1 (Koichi Sasada).

9 messages 2018/05/17

[ruby-core:87250] [Ruby trunk Feature#14785] Parse guard statements like regular conditionals

From: nobu@...
Date: 2018-05-24 05:47:56 UTC
List: ruby-core #87250
Issue #14785 has been updated by nobu (Nobuyoshi Nakada).


Seems the recent `did_you_mean` omits `result` in that case.
It may be able to improve the message, I guess.

----------------------------------------
Feature #14785: Parse guard statements like regular conditionals
https://bugs.ruby-lang.org/issues/14785#change-72239

* Author: jacobevelyn (Jacob Evelyn)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I just learned that these two pieces of code are not the same:

~~~ ruby
def test
  if result = calculate_result
    return result
  end

  ...
end
~~~

~~~ ruby
def test
  return result if result = calculate_result

  ...
end
~~~

The second one will give this unhelpful error message:

~~~
NameError: undefined local variable or method `result' for main:Object
Did you mean?  result
~~~

I think this is confusing, especially since tools like RuboCop sometimes encourage users to change conditionals to inline ones ("guard statements"). I'd like to propose that Ruby be changed to treat these as the same.



-- 
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>

In This Thread

Prev Next