Project

General

Profile

Actions

Feature #17004

open

Provide a way for methods to omit their return value

Added by shyouhei (Shyouhei Urabe) over 3 years ago. Updated over 3 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:99002]

Description

In ruby, it often is the case for a method's return value to not be used by its caller. Even when a method returns something meaningful, its caller is free to ignore it.

Why not provide a way for a method to know if its return value is needed or not? That adds a room for methods to be optimized, by for instance skipping creation of complex return values.

The following pull request implements RubyVM.return_value_is_used? method, which does that: https://github.com/ruby/ruby/pull/3271

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0