[Nitro] Serious discussion on Annotaitons - Part II
transfire at gmail.com
transfire at gmail.com
Mon Nov 13 22:21:56 EST 2006
transfire at gmail.com wrote:
> There is one other possiblity however, while it still would incur some
> penalty I expect it would be fairly lower. Instead of storing
> annotations in a hash, we could store them in class methods. Eg.
>
> Bar.ann :foo, :class => Integer
>
> could translate into
>
> def Bar.ann_foo
> super + @ann_foo
> end
>
> @ann_foo += {:class => Integer}
>
> where #+ is an alias for Hash#merge.
>
> This essentially utilizes Ruby's internal inheritance features to do
> the the same thing my implementation does manually. So although it's
> doing the same thing, it should be fairly faster. It also means the
> basic notation for annotation lookup is:
I further consideratioj of this idea, It seesm to a have one fatal
flaw. Modules qua class aren;t inherited. So super won't catch those.
So the implemention I last posted stands.
T.
More information about the Nitro-general
mailing list