Extend data type


quick question: is it possible to extend a data type as we can do with classes?
Well, actually I’d like to create a new data type which has another one as “Super”.


No, if you mean by data type scalars like booleans, integers, etc.

Ok thanks. So what about if you want to implement complex number for instance? Or quaternions? Any ideas?

You could make a Module and add the globally scoped Structure ‘Complex’, along with extension methods for it. Then you could write stuff like

dim a, b, c As Complex a.set(1,2) b.set(3,4) c = a.multiply(b)

More typically I’d use a class; much more flexible. Why are you trying to not use a class?

If you use a class you should start from scratch…when you create a new data type most of the things are in common with other data types. That’s why I’d like to avoid the use of a class. Or am I missing something?

I’d go for a class for complex numbers.

Also note that you can overload operators: Operator Overloading.

Doesn’t Bob have a plugin for complex numbers?

Indeed he has the Decimal plugin at http://delaneyrm.com/ for big numbers.

big number ? complex numbers … :wink:
but there is a module for complex numbers on the same page.