Jeez... you link a 7 year old blog post about Red compiler and ask if it's possible to create function's at runtime in compiled code - the answer is no, because that would require just-in-time compilation, and current compiler is ahead-of-time one. In general, current compiler cannot support dynamic code.
You can build functions at runtime in interpreter though, that's what func
, function
and other function constructors do all the time.
@rebolek
@9214 please...
:-))))
Vladimir can answer in any way he wants to me. I have started to get used and apreciate the good thing of him (talking personally)
@GiuseppeChillemi
Vladimir can answer in any way he wants to me.
Great :smile:
@9214
Well, I have tried the SET words-block values-block
solution with no success.
test: function
[
action
passed-args-block [block!]
]
[
args-def: [
add
[
the-path [string!]
key [word!]
value [any-type!]
]
del
[
the-path [string!]
key [string!]
]
]
function-words: extract select args-def action 2
set function-words passed-args-block
]
test 'add ["a-path" "a-key" "a-value"]
probe the-path
probe key
probe value
"a-path"
"a-key"
"a-value"
>>>
Words set into function
seems to exists after function exit:
function
only collect set words (+ some exception) and [the-path key value] are words.function
, after first ]
. Your code might compile but it won't run correctly in the repl.
-c
option to compile as you work. It’s much faster than -r
(release mode).@nedzadarek
ps. if you want post simple code snippets that people would run in the repl then avoid unnecessary new lines (e.g. after
function
, after first]
. Your code might compile but it won't run correctly in the repl.
Those "unnecessary" new lines avoid me being confused. Words are isolated and clear and there are not so many symbols that my mind have to decode.