[Nitro] Fwd: Troubles along the class-level heirarchy

TRANS transfire at gmail.com
Fri Jun 9 01:20:19 EDT 2006


On 6/8/06, Jonas Pfenniger <zimba.tm at gmail.com> wrote:
> On 08/06/06, TRANS <transfire at gmail.com> wrote:
> > Oh, one other thing. There is currently no Kernel#ann method. There
> > are a couple ways in which this could be defined. It could 1)
> > reference annotations for the object itself (You may not know this but
> > you can annotate any object via #annotation, not just classes.) or, 2)
> > route to the object's singleton class, or 3) route to the regular
> > class.
> >
> > If #3 then references like 'self.class.ann.foo' can be reduced to
> > 'ann.foo'. But then won't #2 inheirt from the regular class too? If so
> > that would be better than #3 I think. Although maybe #1 is most
> > proper? (But not as useful for reducing 'self.class.ann'.)
> >
> > Thoughts?
>
> Does annotation inherit values like Glue::Configuration ?

Indeed. Glue Configuration is based on the same framework I believe
(i.e. inheritor).

> IMHO object notation are like attr_accessor, so not very usefull.

?

>  What is a
> "regular" class ? I know the singleton class but the other is just the
> class Class ?

Yea. You have an object (obj):

  (class << obj; self; end)  # returns singleton class
  obj.class  # returns regular class

That's all I meant. The question is basically this:

  module Kernel

    # 1
    def ann(*args)
       annotation(*args)
    end

    # 2
    def ann(*args)
       (class << obj; self; end).ann(*args)
    end

    # 3
    def ann(*args)
       self.class.ann(*args)
    end

  end

T.



More information about the Nitro-general mailing list