red / REP

Red Enhancement Process
BSD 3-Clause "New" or "Revised" License
11 stars 4 forks source link

WISH: preprocessor context to be available to macro rules block #128

Open hiiamboris opened 2 years ago

hiiamboris commented 2 years ago

Script:

Red []
#do [abc: 0]
#macro ['macro1 (prin "in rules " ?? abc)] func [s e] [abc: 1000 prin "in body " ?? abc []]
macro1
macro1 
prin "in code " ?? abc

Outputs:

in rules abc: unset!
in body abc: 1000
in rules abc: unset!
in body abc: 1000
in code abc: unset!

I would prefer it to output:

in rules abc: 0
in body abc: 1000
in rules abc: 1000
in body abc: 1000
in code abc: unset!
hiiamboris commented 2 years ago

Specific use case is to enable/disable some macro from other macros. Rules and macro body need to access the same data.

hiiamboris commented 2 years ago

Would also keep those from leaking out into system/words.