From: "bughit (bug hit) via ruby-core" Date: 2023-05-22T17:36:03+00:00 Subject: [ruby-core:113596] [Ruby master Feature#19682] ability to get a reference to the "default definee" Issue #19682 has been updated by bughit (bug hit). In general I would add that there are other implicit contexts in ruby that are not obvious or intuitable in various meta-programming scenarios. They are "default definee" (method definition), constant definition (cref I think) and class variable (`@@`) definition. I don't think their metaprogramming behavior is well documented, so there's good reason for ruby to help with identifying them explicitly. "default definee" starts lexical but can be shifted dynamically (class_eval, instance_eval, ...). Constant definition might be fully lexical and @@ I don't remember anything about from some experimentation long ago. I didn't include ivar definition as I believe that's the simplest and best understood context, fully dynamic, relative to self, AFAIK. But the point here is, there's variance among the implicit contexts and hybrid (lexcial/dynamic) behavior is possible for some, so collectively its not trivial to keep this all in your head on instant recall, there's definitely opportunity for forgetting/confusing. ---------------------------------------- Feature #19682: ability to get a reference to the "default definee" https://bugs.ruby-lang.org/issues/19682#change-103235 * Author: bughit (bug hit) * Status: Open * Priority: Normal ---------------------------------------- https://blog.yugui.jp/entry/846 "default definee" is a pretty important context so why not make it easy to identify? Could be a Module class method or a global method (Kernel) or a keyword. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/