> On May 22, 2019, at 8:16 PM, Keith Medcalf <kmedc...@dessus.com> wrote:
> 
> Basically, User Defined Types (UDT) were implemented in a fashion analgous to 
> a C++ class (remember that at this time C++ was just a pre-processor for C 
> and a C++ class was nothing more than a struct and mangled function names to 
> operate on the class). 

…and a vtable to provide polymorphic dispatch of virtual methods, which is 
required for OOP.

> Basically, when you declared something as a UDT you were giving a "blob" a 
> type-domain.  Whenever you tried to do something with a UDT a "mangled 
> function name" was generated that took that blob as the first argument

Was DB2 using early or late binding of types to blobs? That is, was the type of 
a blob declared as part of the table column, or were individual blob values 
tagged with their own types? This makes a huge difference. In the former 
(early) case the UDTs are just syntactic sugar, while with late-binding they 
really do act like objects. Late-binding is also required if user-defined 
functions are to be allowed to return UDTs.

> you merely implemented a bunch of functions with the appropriate names that 
> DB2 would use whenever you referred to that UDT type, rather than using the 
> builtin functions (this is similar to the way languages like Python implement 
> classes).

Not really; in Python (and Ruby, and Objective-C, and Smalltalk, and sort-of 
JavaScript…) a class is a dictionary that maps method names to anonymous 
functions. The functions themselves don't have names. (Sorry to be pedantic, 
but I'm a bit of a language geek.)

—Jens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to