This page is to discuss how to keep magik code compatible between 4.x and 5.x. Primarily for vendors trying to support both versions, but can be used by those transitioning to 5.
Threading
Engines
SW5 introduce 2 new exemplars to support running processes in a separate thread. They are sw_task and sw_task_owner. All engine code such as models or plugins should inherit from sw_task_owner in SW5. Attached to this page is a 4.3 version of the exemplar so you can move your existing engines over to the new exemplar. Not all functions work, but it does allow for compiling 4.3 and 5.X code with the same magik files.
Magik Syntax
_class Directive
In SW 5, magik classes can inherit from Java objects. the newer definition of this uses the _class directive such as the following.
def_slotted_exemplar(:exemplar,
{},
{:plugin},
{ _class |com.gesmallworld.magik.language.MagikFinalisable|}
)
$
This definition will not compile under 4.x. Attached ignores the _class directive. The following are some restrictions. See file comments for additional info.
- {_class |java.objec|} must be on one line
- Only one _class definition can be used