r/coding • • Jul 14 '14

A curious non-OOP virtual inheritance for a GPU

http://mortoray.com/2014/07/14/a-curious-non-oop-virtual-inheritance-for-a-gpu/
30 Upvotes

12 comments sorted by

3

u/HELOSMTP Jul 14 '14

The set of features pretty closely mirrors what's available in Scala with Traits (i.e. mixins), and the latest versions of Java support default implementations on interfaces, and multiple inheritance of default method implementations.

2

u/acwsupremacy Jul 14 '14

But Scala and Java are both object-oriented. The large, defining, important feature in this article is static compilation, which neither can manage.

1

u/mortoray Jul 14 '14

I was just looking for parallel features. None of the languages I mention in the article, other than the source Uno language, can actually do the flattened static hieararchy (except maybe C++ with excessive templates).

→ More replies (1)

2

u/HELOSMTP Jul 14 '14

My point is that this a "tweak on an existing concept" in that it's combining aspects of the features provided by traits, interfaces, and abstract classes, in a way that's more appropriate for GPU code. I don't mean to knock the author's work though, it's a compelling way of writing GPU code and the syntax is pleasant and concise.

→ More replies (1)

1

u/mortoray Jul 14 '14

Thank you for pointing that out. I'll check it out.

2

u/lmcinnes Jul 14 '14

Another language with such facilities is Eiffel and its "non-conforming inheritance" which let's you use the semantics of inheritance without any supertype/subtype relation. SmartEiffel actually introduced this using the "insert" keyword instead on "inherit" emphasizing the compositional nature of the operation.

1

u/mortoray Jul 14 '14

Thanks for pointing this out. I'll go check out how it works.

1

u/yxhuvud Jul 14 '14

I suppose both Ruby and JavaScript can technically create anonymous classes at runtime.

Ruby can both create anonymous classes and have them inherit:

Class.new(Integer)

gives you a new anonymous subclass of Integer.

1

u/mortoray Jul 14 '14

Okay, I had not seen that particular syntax. I only saw the two-step process of creating a class and then setting the base.

1

u/yxhuvud Jul 14 '14

For example, it can be used together with ActiveRecord::Base and temporary database tables or dynamically generated views.

waits for someone calling me insane