From: mame@... Date: 2019-09-02T14:00:16+00:00 Subject: [ruby-core:94745] [Ruby master Feature#12543] explicit tail call syntax: foo() then return Issue #12543 has been updated by mame (Yusuke Endoh). I don't like `--tail-call-optimization-off`. I will not specify the option, see an omitted backtrace, and then I must re-run my code with the option. It is not an easy-to-debug language for me. And I have another concern. If tail call optimization is on by default, some people will strongly depend on it. For example, someone may write: ``` def main_loop socket = server_socket.accept ... main_loop end ``` This code will break when `--tail-call-optimization-off` is specified. So, I think it should be off by default, and it would be good to allow to write: ``` def main_loop socket = server_socket.accept ... return and main_loop # explicit tail call end ``` ---------------------------------------- Feature #12543: explicit tail call syntax: foo() then return https://bugs.ruby-lang.org/issues/12543#change-81362 * Author: mame (Yusuke Endoh) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: ---------------------------------------- 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 ---Files-------------------------------- then_return.patch (9.18 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: