[REBOL] Passing refinements to sub functions. Re:(2)
From: bhandley:zip:au at: 12-Aug-2000 19:20
Thanks for your response Michael.
Now that's an interesting idea.
I think your approach is good at getting the refinements of the
higher-function processed as a set, but it obscures what happens after that.
My latest approach has been to use an additional refinement on the
sub-function called /refinements. This has an argument of type block that
contains pairs of refinement-name and refinement-value.
Inspired by your work I produced this.
main-func: function [/va /vb /vc][this-code refine-values r][
sub-func/refinements refinements-to-block :main-func va
sub-func: function [/refinements refine-list][va vb vc][
do bind refine-list 'va
print ["va:" va]
print ["vb:" vb]
print ["vc:" vc]
refinements-to-block: function [
refinement-block: copy 
foreach r first :hi-func [
if (refinement? r) and (r <> /local) [
append refinement-block to-set-word r
append/only refinement-block to-paren bind reduce [to-word r]
It results in this:
Of course it doesn't handle any refinement arguments.