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
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!
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.
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 .