From: Joseph Jones Date: 2015-12-17T21:13:23-07:00 Subject: [ruby-core:72343] [Ruby trunk - Bug #11779] [Open] Mudule#using does not make sense as a method --567387e3_53584bcb_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 6, 2015 at 14:40:= 14 MST, alxtskrnk=40gmail.com wrote:Issue =2311779 has been reported by b= ug hit.----------------------------------------Bug =2311779: Mudule=23usi= ng does not make sense as a methodhttps://bugs.ruby-lang.org/issues/11779= * Author: bug hit* Status: Open* Priority: Normal* Assignee: * ruby -v: 2= .2.3* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN---------------= -------------------------1. it can't be called from another method2. the = receiver must be self3. since refinements are lexically scoped the self r= eceiver must match the currently open class=233 is particularly curious=60= =60=60rubymodule Refinement refine String do def refined=3F true end ende= ndmodule =46oo def self.refined=3F ''.refined=3F rescue false endendmodul= e Bar def self.refined=3F ''.refined=3F rescue false end =46oo.module=5Fe= val do using Refinement endendp =46oo.refined=3F =23false=60=60=60The mod= ule=5Feval =60=23using=60 call does not raise (it's not from a method and= the receiver is self), but evidently because currently open class does n= ot match self, it does not do anything. So it should at least raise.So =60= =23using=60, though a method, does not function as a method, which is mis= leading.-- https://bugs.ruby-lang.org/ --567387e3_53584bcb_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 6, 2015 at 14:40:14 MST, alxtskrnk=40gmail.com wrote:
Issue =2311779 has been repor= ted by bug hit.

----------------------------------------
= Bug =2311779: Mudule=23using does not make sense as a method
https:/= /bugs.ruby-lang.org/issues/11779

* Author: bug hit
* Stat= us: Open
* Priority: Normal
* Assignee:
* ruby -v: 2.2.3<= br />* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
--------= --------------------------------
1. it can't be called from another = method
2. the receiver must be self
3. since refinements are le= xically scoped the self receiver must match the currently open class

=233 is particularly curious

=60=60=60ruby
module = Refinement
refine String do
def refined=3F
tru= e
end
end
end

module =46oo
def sel= f.refined=3F
''.refined=3F rescue false
end
end


module Bar
def self.refined=3F
''.refined=3F= rescue false
end
=46oo.module=5Feval do
using Ref= inement

end
end

p =46oo.refined=3F =23false<= br />=60=60=60

The module=5Feval =60=23using=60 call does not = raise (it's not from a method and the receiver is self), but evidently be= cause currently open class does not match self, it does not do anything. = So it should at least raise.

So =60=23using=60, though a metho= d, does not function as a method, which is misleading.


<= br />--
https://bugs.ruby-lang.org/
<= /body> --567387e3_53584bcb_16c--