Page 1 of 1

Compiler - Macros/Directives etc... IDEA

Posted: Sun Jun 01, 2003 4:51 am
by HarryO
I have been reading the posts related to compile time capabilities.

I have an idea (WARNING!!! NOT FULLY THOUGHT OUT)

Observation:

Most (if not all) of the request are really aimed towards being able
to manipulate/change information at the point-in-time the source code
gets compiled.

Currently, Constants use the '#' notation (token).

While the existing compiler directives are treated as seperate tokens.

This token now means "Evalute expression at compile time only".

Suggestion:

Why not use the same token (#) to mean that any expression which
follows is to be evalutated only at compile time. For example:

;
;- Constants
;
;Existing capabilities

#Start = 0
#Var_1 = #Start : #Start = #Start + 1
#Var_2 = #Start : #Start = #Start + 1

; New capabilities
#Char_Pos.w = 1
#Char_1.b = #Mid(#String(#PB_Compiler_Date,#Char_Pos,1))
#Char_pos = #Char_Pos = #Char_pos + 1
#Char_2.b = #Mid(#String(#PB_Compiler_Date,#Char_Pos,1))
#Char_pos = #Char_Pos = #Char_pos + 1

This would allow the use of any (Most??) of the commands to act as
a compiler directive/macro language.

OK, FLAME SUIT ON!!! What does everyone think of this?

HarryO

Posted: Sun Jun 01, 2003 4:22 pm
by plouf
this can be only be done on specific command such as chr() and only
with constant ,if i am not wrong #contant = chr(20) : debug #constant allready works.
since char(i) it is dynamically calculated on runtime ,and this is correct way,
cannot be done.
may be some more command should be added such as Asc() and more
i think its allready discussed sometime anyway