LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Intaris

Add support for "Uninheritable" methods and classes in LabVIEW

Status: Duplicate

According to Wikipedia:

In some languages a class may be declared as uninheritable by adding certain class modifiers to the class declaration. Examples include the "final" keyword in Java or the "sealed" keyword in C#. Such modifiers are added to the class declaration before the "class" keyword and the class identifier declaration. Such sealed classes restrict reusability, particularly when developers only have access to precompiled binaries and not source code.

The sealed class has no subclasses, so it can be easily deduced at compile time that references or pointers to objects of that class are actually referencing instances of that class and not instances of subclasses (they don't exist) or instances of superclasses (upcasting a reference type violates the type system). subtype polymorphism. Because the exact type of the object being referenced is known before execution, early binding (or "static dispatch") can be used instead of late binding (also called "dynamic dispatch" or "dynamic binding") which requires one or more virtual method table lookups depending on whether multiple inheritance or only single inheritance are supported in the programming language that is being used.

 


 

I have previously made appeals to allow for certain classes to restrict the ability to load new ancestors at run-time, thus restricting possibly allowing for inlining of dynamic dispatch VIs.  A similar request has already been made in order to facilitate ilining of DD VIs.  I believe that ultimately, it is support for a "Final" or "Sealed" class what I am looking for.

 

Such a modification on a class would effectively prohibit instantiation of any new version via factory method and would declare to the compiler that the code defined at compile-time is actually the full extent of code which will be available at run-time, thus allowing for the aforementioned optimisations to take place.

 

Questions would have to be answered regarding type propagation and some loopholes may remain regarding dynamic loading of new classes (only dynamic dispatch methods which are visible as instances of the "final" class can actually safely be inlined for example).  Especially for a specific RT application of mine, this would be a great benefit as the natural progression of this idea is indeed the ability to write code such that dynamic dispatch VIs are actually inlineable.

4 Comments
wiebe@CARYA
Knight of NI

This new (duplicate) idea: Allow for "Final" specifier on Class Override seems to get more traction than this one. It's the same idea, AFAIC, but maybe laid out simpler.

Intaris
Proven Zealot

Ive seen it. I personally dont care as long as the feature gets done eventually

wiebe@CARYA
Knight of NI

Yes, but a good reason for bumping this one!

Christina_R
Active Participant
Status changed to: Duplicate
 

Christina Rogers
Principal Product Owner, LabVIEW R&D