Yes, we have another way
>> z: make object! [b: 0 c: 1 d: 2] >> probe pick third z 1 b: == b:
functiondialect binds all set-words to a new inner context.
'valueis local to the loop.
I am working on having a single function with different arguments length depending on the "method" of the function.
alter-db 'add-rows ["db-name" "table-name" [column1 column2 column3]] alter-db 'remove-table ["db-name" "table-name"]
alter-db has different number of arguments depending on the method used
Inside alter-db I have a block which specifies the words of the arguments
Alter-DB is defined as
Alter-DB: function [ method arg-block ] [ fnc-args: [ 'add [db table rows] 'remove-table [db table] ] ]
I want to associate each word in a method i.e. 'ADD has -db table rows-
To the corresponding word in arg-block
What if I use a global function like:
set-args: function [my-args arg-words] [ set select my-args method arg-words ..... ]
and call it from the inside of
set-args fnc-args arg-block
After selecting them ?
How do I bind words to the calling function ?
setdoesn't deal with binding... that's the magic, it just uses the word's binding (remember that all
any-word!types store their binding internally)