Right now (Note: original post written circa 2021) when doing a low-level build of a FRAME! for a function, you are on the hook for knowing the callsite parameter convention and doing what it takes to meet the expectation.
-
So for a quoted (literal) parameter, you have to take that into account...since no callsite quoting is going on, you must do your own quoting in the assignment.
- This isn't particularly new--you had to do your own quoting when using Rebol2 APPLY, also. The quoting convention in the function spec wouldn't be heeded inside the apply block.
-
Same for a meta parameter...there's no callsite that's converting things from antiforms into a non-antiforms, or adding quote levels. When you are assigning fields in the frame you have to remember to LIFT them.
It means that if the parameter convention changes, what you might have written for a MAKE FRAME! previously won't work.
Let's say someone writes a function that returns if something is greater than 10:
greater-than-10: func [x [integer!]] [
return x > 10
]
Then you write code that builds a frame for it:
f: make frame! greater-than-10/
f.x: 20
assert [eval f]
It works. Yet later the person who wrote the function decides they want to do something special if it's passed an unstable antiform, while keeping the behavior for integers the same.
Let's imagine they want to make it so that it tests all integers in a pack, if you give it a pack:
greater-than-10: func [^x [integer! pack!]] [
if pack? ^x [
... code for testing if each element in pack > 10 ...
] else [
^x > 10
]
]
>> greater-than-10 20
== \~okay~\ ; antiform
>> greater-than-10 pack [20 30]
== \~okay~\ ; antiform
>> greater-than-10 pack [10 20]
== \~null~\ ; antiform
Why did the person who switched the parameter to ^META add this feature? Who knows. But let's say they thought it was okay because the callsites they knew about would remain working.
But it breaks our invocation via FRAME!.
>> f: make frame! :greater-than-10
>> f.x: 20
== 20
>> eval f
** Error: X is a ^META argument, must be QUOTED! or QUASIFORM!
You have to now adjust how you fill the frame to meet the meta requirements:
>> f: make frame! greater-than-10/
>> f.x: quote 20
== '20
>> eval f
== \~okay~\ ; anti
UPDATE 2025: There is an awesome alternative to saying
f.x: lift 20
orf.x: quote 20
which is now to use metavariables, e.g:>> f.^x: 20 == 20 >> f.x == '20