Page 1 of 1
[Implemented] MacroOff
Posted: Mon Jun 14, 2010 9:12 am
by Josh
Code: Select all
Macro MyNot
Not
EndMacro
.....
.....
.....
MacroOff MyNot
when i'm writing a pbi with reusable code, maybe i'm using some macros used only in my pbi-code. using MacroOff at the end of my pbi-code, i can prevent the change of code outside my pbi-code.
Re: MacroOff
Posted: Fri Jun 18, 2010 3:23 am
by netmaestro
If you're producing library code, all your variable names, arrays, lists, maps, macros, proprietary structures, virtually everything that has a name should be called by a name uniquely identifying the library name first, and then finally the childelement name. For example, _nmpbi243_array_1dim_long_areas() or such. This way, there is no possibility that a user of your library will duplicate your nomenclature by coincidence. Also, you can at a glance, three years later, know exactly what you're looking at. Your MacroOff suggestion, while reasonable, only addresses macros. What about everything else? If you follow rigid, granular, thoroughly-planned naming conventions, this idea will never be necessary.
When you're young and the coding world is new, short cryptic names seem cool. But after adding your seventy-fifth library, believe me when I tell you: they're not.
Re: MacroOff
Posted: Fri Jun 18, 2010 12:04 pm
by jamba
i could see the macro off being useful, but with accurate naming conventions it shouldn't be a problem.
When you're young and the coding world is new, short cryptic names seem cool. But after adding your seventy-fifth library, believe me when I tell you: they're not.
too true!

Re: MacroOff
Posted: Fri Jun 18, 2010 2:24 pm
by Josh
i know, what i can make with well selected names. i never have problems with names of variables and so on, because i use global variables only if there is no other way.
actually i'm writing a program, witch creates pb-code from typelibs. in this code are many interfaces, which later used by the programmer. since pb 4.5 you have the help for interfaces in the statusbar and i want to give the programmer the maximum of informations about needed parameters. ok, there are many ways to do that, but i don't know the name of the parameter, because the name comes from the typelib. i didn't want to change the name of the parameter, so i thought, i give some informations in the type of the parameter (i.e.
AnyParameterName.date) and change this information to a nativ type by macro. the same for example for unsigned longs
so i have a problem, because i can't say to the programmer, don't use the name 'date' in your code. if i can stop my macro at the end of my pbi-file, there is no problem. i'm not a programmer of compilers, but imho, the compiler has a 'list' of macros and when it see the
MacroOff statement, the compiler is deleting the macro from the 'list'. maybe it's not a quantity of work to implement this function.