Comment on this RCR (edit wiki page) | RCRchive home

RCR 228: Uniform meta-access while parsing Ruby code

submitted by itsme213 on Thu Mar 11 2004 11:34:50 AM -0800

Status: withdrawn


Abstract

Ruby's exposing of self within a class body is one of its powerful extensibility features. This RCR proposes similar uniform access via self to methods, parameters, constants, etc. to allow extensibility of all of these elements.

Problem

Facilities such as attr rely on methods on Class being invoked within a class body with self = current_class. By POLS, similar access should be provided to methods defined on syntactic elements such as:

Proposal

Generalize class facilities like attr (in the same spirit as SAX events) by doing the following:

Analysis

Implementation

If I knew more of how the Ruby grammar was being implemented I could probably suggest something.

Vote for this RCR

Strongly opposed [2]
Opposed [2]
Neutral [0]
In favor [0]
Strongly advocate [1]

Change the status of this RCR to:

accepted

rejected

withdrawn


The Ruby grammar is implemented with lex/yacc IIRC. However, I'm not sure that this makes any sense as stated. As of right now, it's not necessary to enclose parameter lists inside of parentheses, so no "code" can be between def foo and (a, ...). I also don't think that meta-code is necessary or useful for the parameter lists themselves.

Far better would be the oft-suggested (and it might even be on the current list of RCRs) change that all keywords return something useful, e.g.:

And so on, as needed. -- Austin Ziegler


This RCR is breaking a few RCR rules:

Please resubmit it, if you really want to propose something.

--matz.

Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog