[#61822] Plan Developers Meeting Japan April 2014 — Zachary Scott <e@...>

I would like to request developers meeting around April 17 or 18 in this month.

14 messages 2014/04/03
[#61825] Re: Plan Developers Meeting Japan April 2014 — Urabe Shyouhei <shyouhei@...> 2014/04/03

It's good if we have a meeting then.

[#61826] Re: Plan Developers Meeting Japan April 2014 — Zachary Scott <e@...> 2014/04/03

Regarding openssl issues, I’ve discussed possible meeting time with Martin last month and he seemed positive.

[#61833] Re: Plan Developers Meeting Japan April 2014 — Martin Bo煬et <martin.bosslet@...> 2014/04/03

Hi,

[ruby-core:62224] [ruby-trunk - Feature #9777] Feature Proposal: Proc#to_lambda

From: richard.schneeman@...
Date: 2014-04-29 19:02:22 UTC
List: ruby-core #62224
Issue #9777 has been updated by Richard Schneeman.


Andrew Vit wrote:
> Would it work to just wrap it inside a lambda to get the semantics you want?

Like `lambda &proc`? That would be fine. As Nobu mentioned Proc and lambda behave differently, sometimes I want control over the behavior of my program so I want the ability to change the object I am using from proc to lambda or lambda to proc.

When I made the original request I did not know that `lambda#to_proc` was basically a no-op. I thought it actually changed the behavior.

----------------------------------------
Feature #9777: Feature Proposal: Proc#to_lambda
https://bugs.ruby-lang.org/issues/9777#change-46371

* Author: Richard Schneeman
* Status: Feedback
* Priority: Normal
* Assignee: 
* Category: core
* Target version: current: 2.2.0
----------------------------------------
Currently different block objects such as a lambda can be converted into to a proc: http://www.ruby-doc.org/core-1.9.3/Proc.html#method-i-to_proc

However you cannot turn a Proc instance into a lambda. Since a Proc and lambda behave differently sometimes you may want to convert between the two functionalities. One example is a `return` inside of the block. In a lambda the `return` keyword exits the closure, in a Proc the `return` keyword raises an exception.

There is currently no implementation standard way to convert a Proc to a lambda. I made a gem that makes this easier: https://github.com/schneems/proc_to_lambda but it seems overkill.

If MRI introduces a `to_lambda` method on Proc then we can standardize on an interface for this behavior. This question on stack overflow has been upvoted many times: http://stackoverflow.com/questions/2946603/ruby-convert-proc-to-lambda. I think other Ruby developers would like this behavior supported by Ruby core.





-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next