MacroReturn?
Posted: Sun Jan 13, 2008 10:03 pm
Hi people.
I think, for syntax-true programming with Macros, a MacroReturn could be usefull.
What´s that?
With a Procedure you can Write:
With a Macro you have to add a special Parameter:
In the upper example with Procedure, everything is clear, but in the Macro-Example, it´s not clear to see (in a complexer Code, I mean
) that there is a new value associated to var3.
So my Idea would be:
the compiler could just put all the stuff which is not in the Line of the "MacroReturn" above the current Line (var=MyReturn(5,3)) and replace MyReturn(5,3) with 5+3.
Like this:
This way, it would be possible to use macros to have a better speed.
The only thing that has to be watched out for is, that MacroReturn has to be the last Line of the Macro
Does anyone understand me? :roll:
I think, for syntax-true programming with Macros, a MacroReturn could be usefull.
What´s that?
With a Procedure you can Write:
Code: Select all
Procedure MyReturn(var1,var2)
; Do some stuff in several Lines (not possible in one line)
ProcedureReturn var1+var2
EndProcedure
var3=MyReturn(5,3)
Code: Select all
Macro MyReturn(var1,var2,result)
;Do some stuff in Several Lines (not possible in one line)
result=var1+var2
EndMacro
MyReturn(5,3,var3)

So my Idea would be:
Code: Select all
Macro MyReturn(var1,var2)
;Do some stuff in Several Lines (not possible in one line)
MacroReturn var1+var2
EndMacro
var3=MyReturn(5,3)
Like this:
Code: Select all
;Do some stuff in several Lines(not possible in one line)
var3=5+3
The only thing that has to be watched out for is, that MacroReturn has to be the last Line of the Macro
Does anyone understand me? :roll: