Hello,
This kind of code needs function prototyping.
proc a()
proc b()
proc a() =
echo "a"
b()
proc b() =
echo "b"
Is it possible to auto-declare the procedures ? May be with a macro, for generating the beginning (but should parse the entire AST for finding functions ?):
proc a()
proc b()
Thank you.
I suspect it's on the list of things to be revisited and formalised after incremental compilation lands?
Exactly.
thank you for the answer.
{.codeReordering.} is interesting for usual cases, but mine looks like this:
type RGB = enum r,g,b
#proc pr()
#proc pg()
#proc pb()
var fx = [ r:pr, g:pg, b:pb ]
var currfx = fx[r]
proc pr() =
currfx = fx[g]
echo "red will be green next time"
proc pg() =
currfx = fx[b]
echo "green will be blue next time"
proc pb() =
currfx = fx[r]
echo "blue will be red next time"
currfx()
currfx()
currfx()
so i believe i will have to keep prototyping or find a way to do it with either:
Guess what, for the moment i think i stick to the old fashioned prototyping :)