ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:72343] [Ruby trunk - Bug #11779] [Open] Mudule#using does not make sense as a method
@ 2015-12-18  4:13 Joseph Jones
  0 siblings, 0 replies; only message in thread
From: Joseph Jones @ 2015-12-18  4:13 UTC (permalink / raw)
  To: Ruby developers; +Cc: ruby-core

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

Joseph Jones liked your message with Boxer. On December 6, 2015 at 14:40:14 MST, alxtskrnk@gmail.com wrote:Issue #11779 has been reported by bug hit.----------------------------------------Bug #11779: Mudule#using 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 receiver must match the currently open class#3 is particularly curious```rubymodule Refinement refine String do def refined? true end endendmodule Foo def self.refined? ''.refined? rescue false endendmodule Bar def self.refined? ''.refined? rescue false end Foo.module_eval do using Refinement endendp Foo.refined? #false```The module_eval `#using` call does not raise (it's not from a method and the receiver is self), but evidently because currently open class does not match self, it does not do anything. So it should at least raise.So `#using`, though a method, does not function as a method, which is misleading.-- https://bugs.ruby-lang.org/     

[-- Attachment #2: Type: text/html, Size: 1829 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-18  3:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18  4:13 [ruby-core:72343] [Ruby trunk - Bug #11779] [Open] Mudule#using does not make sense as a method Joseph Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).