[REBOL] Re: Getting version number of a Rebol Program.
From: brett:codeconscious at: 22-May-2003 14:11
Your idea of loading the script is probably fine, but depending on your
REBOL version have a look at LOAD/ALL and CONSTRUCT to avoid inadvertently
evaluating header elements.
Construct is safer than Context and DO where the source block is potentially
untrustworthy. Compare these:
probe construct [title: "test" version: 1.0.0 print now]
probe context [title: "test" version: 1.0.0 print now]
Also don't forget that a header is made up of pairs of set-word! and values.
Each set-word! is a value.
So once you have your header block you could just do the following:
select [Title: "test" version: 1.0.0] to-set-word 'version
But this is probably better
hdr: construct [Title: "test" version: 1.0.0]
hdr/version
Regards,
Brett.