- DelphiTools - https://www.delphitools.info -

Re-rooting Object Pascal

A while ago I asked about the name of TObject ancestor [1], well, it’s now live in the SVN and its name is ‘Object‘.

Object is thus the new root class, above TObject. Eventually, it’ll be the ancestor for every other type.

JObject

The earliest need for migrating to a rooted type system was to unify TObject and the new JObject, which is is the new root class for all “prototypal inheritence” JavaScript classes in SmartMS [2] (while TObject remains the root for classical Pascal classes).

Subclasses of JObject are either purely external classes (implemented on the JS side, in the DOM, etc.) or Pascal classes compiled to JavaScript, but that follow the JavaScript “object” conventions rather than the Pascal conventions, ie.

These classes are intended primarily for consumption by “external” JavaScript libraries.

They’ll look and behave like “pure” JavaScript classes, so will share their downsides (no obfuscation, no whole-program optimizations, no elimination of unused methods by the smart-linker, etc.); Still, they retain some Smart Pascal advantages (strong typing, local optimizations, obfuscation of method implementations, case insensitivity on the Pascal side).