Open Exchange App Managed-Language-Extensions

Primary tabs

Clean-up your %ZLANG****
This an extraordinary feature of Caché and IRIS
The guide “Extending Languages with %ZLANG Routines” tells you all details you need to know.
EXCEPT: How to do it in a clean way.

This example of a %ZLANGC00.mac may show a possible approach
to get an easy to overview and to manage setup.
With less than 50 lines of code you might not be affected.
But if your Studio shows close to 1000 rows or more you may get in troubles.

My recommendation is simple.
Instead of adding line by line commands and it's code
you isolate each command and its code into a separate Include file.

And what is left in your %ZLANG* Routines is simple and easy to overview list of
included customized Commands, Functions, Variables
See the details in an example for %ZLANGC00.

BTW: #include can do more than just host #define, .. for $$$_references


Any reason to store code in INC instead of MAC or even better - classmethods?

CLANG would contain one line calls to the classmethods.

While you could use INC, I'm not sure why one would prefer doing it this way.

  • All doc said for decades you have to use for language extensions.
  • the closes to .inc was  .mac almost  identic to .int
  • and the  single .obj generated from .inc  stays in memory since start up
  • using .inc allows to organize %ZLANGC00 like a shopping list which is comfortable if the generate .int ends up in many hundred lines of code. and is almost unreadable.

So far for history.
Today where neither memory nor disk access is really relevant this isn't important anymore.
The whole concept of language extensions isn't relevant anymore. Any class method could do it.
I guess no one starting today will use it anymore.
BUT there are some millions of lines of code out in the field that make use of it.

So the suggestion doesn't address fresh starters,
but those that follow up the "great" designers from the last millennium that have
left back that type of code to their (poor) successors.

But old code is everywhere.
Take a look on %R* and %G* utilities and enjoy old style coding. (DO with dots )