From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 6BC5319E005C for ; Fri, 18 Dec 2015 12:42:48 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 7977BB5D8BB for ; Fri, 18 Dec 2015 13:14:55 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id D59DD18CC7E7 for ; Fri, 18 Dec 2015 13:14:55 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 256CE120786; Fri, 18 Dec 2015 13:13:56 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from mail-ig0-f170.google.com (mail-ig0-f170.google.com [209.85.213.170]) by neon.ruby-lang.org (Postfix) with ESMTPS id 1889C120721 for ; Fri, 18 Dec 2015 13:13:23 +0900 (JST) Received: by mail-ig0-f170.google.com with SMTP id ph11so28088566igc.1 for ; Thu, 17 Dec 2015 20:13:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:subject:mime-version:content-type; bh=/8lPh5jyCBYWlgyC8dbqIDtdqGAfSuQvSq8R4P1//4U=; b=nnBuF24NUc5QICIpsEbCf/jndqlbqAFJUgJvHk8KI4iqCykRG8qCJn+8Wc8eImyor9 PrwPFoRhoxilp8CdQYFVn37Zj69nFYD+awXse1qRhjeiCG3yTG+xGgH/mEPc9GXRDT+K TYHuw3zT+3LFwRsxtOkR9R+VMgwtQeyRK2nhQAnyre+gwEAlbR0VIti+K5iQwnL6I/Kl lIz4nrOiK3u6T+IkfuGTDBmsNcCMiz7zoRwln3jMYmtRA8t6Y0rxX8WiImEYIdpdqFHw 56d1XeXbrixUpl9vDi/F8rx+fi62qAlPelYbFcYHkFzOhUslUJCzYKAZ6PelEn+fpBr5 /JMA== X-Received: by 10.50.56.110 with SMTP id z14mr524830igp.0.1450412001881; Thu, 17 Dec 2015 20:13:21 -0800 (PST) Received: from Josephe-Jones (75-166-130-47.hlrn.qwest.net. [75.166.130.47]) by smtp.gmail.com with ESMTPSA id f74sm5835172ioe.6.2015.12.17.20.13.21 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Dec 2015 20:13:21 -0800 (PST) Date: Thu, 17 Dec 2015 21:13:20 -0700 From: Joseph Jones To: Ruby developers Cc: Message-ID: <9B941B52-C450-4C0B-AE0C-8BA4CBC1D32F@gmail.com> X-Mailer: BoxerFree 6.0.4 (321) X-Boxer-Generated: true X-Boxer-IsLike: true MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="567387e0_1d9f6e5f_16c" X-ML-Name: ruby-core X-Mail-Count: 72341 Subject: [ruby-core:72341] [Ruby trunk - Feature #9451] Refinements and unary & (to_proc) X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" --567387e0_1d9f6e5f_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 5, 2015 at 20:13:= 48 MST, justcolin=40gmail.com wrote:Issue =239451 has been updated by Col= in =46ulton.Is there any update on this feature=3F In Ruby 2.2.3 I still = run into a problem where the unary & can not be used when the method was = added with a refinement, such as the following:=60module Example refine S= tring do def pugs =22Pugs=21=22 end endendusing Exampleputs ('a'..'z').ma= p(&:pugs)=60I can understand why they currently do not work, but it leads= to uglier code.----------------------------------------=46eature =239451= : Refinements and unary & (to=5Fproc)https://bugs.ruby-lang.org/issues/94= 51=23change-55254* Author: Jan Lelis* Status: Assigned* Priority: Normal*= Assignee: Yukihiro Matsumoto----------------------------------------Not = sure if this is a bug or feature request:=7E=7E=7Erubyrequire 'minitest/a= utorun'require 'set'module ClassToProc refine Class do def to=5Fproc lamb= da=7B =7C*args=7C self.new(*args) =7D end endendusing ClassToProcdescribe= 'Class=23to=5Fproc' do it 'works when called directly' do Set.to=5Fproc=5B= =5B1,2=5D=5D.must=5Fequal Set=5B1,2=5D end it 'fails when called via ampe= rsand' do =5B=5B1,2=5D=5D.map(&Set).must=5Fequal =5BSet=5B1,2=5D=5D enden= d=7E=7E=7EThe second example errors with *NoMethodError: super: no superc= lass method =60to=5Fproc' for Set:Class*Would be great to have it, though= .-- https://bugs.ruby-lang.org/ --567387e0_1d9f6e5f_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 5, 2015 at 20:13:48 MST, justcolin=40gmail.com wrote:
Issue =239451 has been update= d by Colin =46ulton.


Is there any update on this feature= =3F In Ruby 2.2.3 I still run into a problem where the unary & can not be= used when the method was added with a refinement, such as the following:=

=60
module Example
refine String do
def = pugs
=22Pugs=21=22
end
end
end

using Example

puts ('a'..'z').map(&:pugs)
=60

I can understand why they currently do not work, but it leads to uglier = code.

----------------------------------------
=46eature = =239451: Refinements and unary & (to=5Fproc)
https://bugs.ruby-lang.= org/issues/9451=23change-55254

* Author: Jan Lelis
* Stat= us: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto<= br />----------------------------------------
Not sure if this is a = bug or feature request:

=7E=7E=7Eruby
require 'minitest/a= utorun'
require 'set'

module ClassToProc
refine Cl= ass do
def to=5Fproc
lambda=7B =7C*args=7C self.new(*= args) =7D
end
end
end

using ClassToProc
describe 'Class=23to=5Fproc' do
it 'works when called di= rectly' do
Set.to=5Fproc=5B=5B1,2=5D=5D.must=5Fequal Set=5B1,2=5D=
end

it 'fails when called via ampersand' do
= =5B=5B1,2=5D=5D.map(&Set).must=5Fequal =5BSet=5B1,2=5D=5D
end
end
=7E=7E=7E

The second example errors with *NoMethodE= rror: super: no superclass method =60to=5Fproc' for Set:Class*

Would be great to have it, though.




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