Project

General

Profile

Actions

Feature #12543

open

explicit tail call syntax: foo() then return

Added by mame (Yusuke Endoh) about 5 years ago. Updated 4 months ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:76235]

Description

How about introducing a new syntax for tail call?

def foo()
  foo()
end
foo() #=> stack level too deep
def bar()
  bar() then return
end
bar() #=> infinite loop
  • no new keyword (cf. goto foo())
  • no conflict with any existing syntax
  • an experimental patch is available (attached)
  • no shift/reduce nor reduce/reduce conflict in parse.y

--
Yusuke Endoh mame@ruby-lang.org


Files

then_return.patch (9.18 KB) then_return.patch mame (Yusuke Endoh), 07/02/2016 05:23 PM

Related issues

Related to Ruby master - Feature #6602: Tail call optimization: enable by default?Feedbackko1 (Koichi Sasada)Actions
Has duplicate Ruby master - Feature #16945: Enable TCO by use of special formClosedActions
Actions

Also available in: Atom PDF