Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JIT Inheritance

4 views
Skip to first unread message

Lou Henry Alvarez

unread,
Nov 19, 2015, 3:37:40 PM11/19/15
to
This flavor of the inheritance model allows our modular closures to have similar properties to the inheritance of classes. With it you can expect to have access to its super members as part of the call, just like you would with classes. In addition to the inheritance resulting from versioning, JIT inheritance presents a more complete scenario adding color to the picture painted by code injectors. The key takeaway here is this: Code Injectors are mix-ins that share a similar inheritance model with classes. You can version them to gain access to versioned inheritance or you can override its members to access an ancestor chain comprised of all previous tags. As always we will use some example code to illustrate:

#
# Our Modular Closure
#
Tag1 = jack :Tagger do
def m1
1
end

def m2
:m2
end
end

#
# Normal Versioned Injector inheritance
#
Tagger do
def other
'other' # -- same ancestors as before
end
end

expect(Tagger().ancestors).to eql( [Tagger()] )

# test it

o = Object.new.extend(Tagger())

# inherited
o.m1.should == 1
o.m2.should == :m2

# current
o.other.should == 'other'


#
# JIT inheritance
#
Tag2 = Tagger do
def m1 # The :m1 override invokes JIT inheritance
super + 1 # -- Tag1 is summoned into ancestor chain
end # -- allows the use of super

def m3
'em3'
end
end

# test it

p = Object.new.extend(Tag2)

# JIT inherited
p.m1.should == 2

# regular inheritance
p.m2.should == :m2
p.m3.should == 'em3'
p.other.should == 'other'

expect(Tagger().ancestors).to eql( [Tagger(), Tag1] )
expect(Tag2.ancestors).to eql( [Tag2, Tag1] )


For more please visit: http://jackbox.us


Thanks again,

Lou

Robert Klemme

unread,
Nov 30, 2015, 12:30:35 PM11/30/15
to
On Thursday, November 19, 2015 at 9:37:40 PM UTC+1, Lou Henry Alvarez wrote:
> This flavor of the inheritance model allows our modular closures to have similar properties to the inheritance of classes. ...

The language in this group is German - "man spricht Deutsch".

robert

Quintus

unread,
Dec 1, 2015, 1:03:36 PM12/1/15
to
Das ist ein Spammer. Der hat denselben Beitrag u.a. auch völlig
themenfremd auf der Padrino-Mailingliste gecrossposted.

Viele Grüße
Marvin
--
#!/sbin/quintus
Blog: http://www.guelkerdev.de

GnuPG key: F1D8799FBCC8BC4F

Robert Klemme

unread,
Dec 1, 2015, 1:54:21 PM12/1/15
to
On 01.12.2015 19:03, Quintus wrote:
> Das ist ein Spammer. Der hat denselben Beitrag u.a. auch völlig
> themenfremd auf der Padrino-Mailingliste gecrossposted.

Danke für den Hinweis! Bisher habe ich ihn nur für einen nervigen
Zeitgenossen gehalten, der unbedingt sein Ruby-Projekt an den Mann
bringen will. Aber wenn er mit dem Thema auch Gruppen behelligt, die
nix mit Ruby am Hut haben, ist das was anderes.

Bis später

robert


--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Quintus

unread,
Dec 5, 2015, 4:40:52 PM12/5/15
to
> Aber wenn er mit dem Thema auch Gruppen behelligt, die
> nix mit Ruby am Hut haben, ist das was anderes.

Naja, Padrino ist ja schon noch ein Ruby-Webframework[1]. Trotzdem
erfüllt so ein crossposting für mich die Definition von Spamming.

Viele Grüße
Marvin

[1]: http://www.padrinorb.com/
0 new messages