Skip to Main Content
InterSystems Ideas
We love hearing from our users. Tell us what you want to see next and upvote ideas from the community.
* Bugs and troubleshooting should as usual go through InterSystems support.
Status Will not implement
Created by Julius Kavay
Created on May 29, 2025

Macros in Classes

Currently, there are two possibilities to use macros in a class

1) with the "Include" keyword at the beginning of a class definition

2) in EACH (class)metod definition one or more macros can be defined with the "define", "def1arg", etc. keywords

If the same macro(s) is/are used in several methods, then we have two choices:

a) (re)define the macro in each method where it is needed

b) create a new include file for the class in question and include that file at the beginning of the class

The problem:

Solution a) is OK if one or two macros are used just in few methods but it is be cumbersome if those macros are used in many methods

Solution b) has also its drawbacks. We get many short include files, often with the same but different named macro, etc. because the macros were defined to different times from different developers

My idea and solution:

In addition to the include files, let the compiler accept macro definitions (#define, #def1arg, etc.) at the beginning of a class definition too, something like this:

Define MACRO1

Include INCLUDEFILE

Define MACRO2

The "rules", considering the above example:

- "Define" and "Include" are both optional

- MACRO1 can be overwritten by a MACRO1 defined in the INCLUDEFILE

- MACRO2 can overwrite a MACRO2 defined in the INCLUDEFILE

  • ADMIN RESPONSE
    Jul 9, 2025

    Thank you for submitting the idea. Based on information from our experts the status of your idea was changed to "Will not implement". Please look for details in the comments on the idea. Good luck!

  • Timo Lindenschmid
    Jun 11, 2025

    I agree local class macros is definitely a missing component. Especially as modifying and compiling a include file does not trigger compilation if dependent classes.

  • Robert Cemper
    May 30, 2025

    Total agree!

    We have transient properties
    We have parameterstatt are local to the class.
    Local Macros are definitely a missing components.
    For pure values we may use Parameters, computed properties.
    BUT: a Macro can and mostly does reflect a piece of static code.
    all ZLANG+ stuff goes that direction. But this is not LOCAL.

    The concept of macros goes back to early Assembler Languages,
    to define a static sequence of commands. A key success factor at that time.
    The concept war taken into .MAC code in COS.
    I have no imagination why it filed to be available also in Classes .