Prior to splices, we were considering rethinking append/only [a b c] [d e] as append [a b c] only [d e], where ONLY would just envelop its argument in a block.
@rgchris didn't care for the name:
As it happens, ONLY defined in this way stuck around for a while. (I actually thought it had been deleted, but it turns out it was hiding as **only*
, so just finally deleted it now!)
I agree that ENVELOP is a better and more useful name for the category of operations. Today we have ENBLOCK and ENGROUP:
>> enblock [a b c]
== [[a b c]]
>> enblock <tag>
== [<tag>]
>> engroup [a b c]
== ([a b c])
>> engroup <tag>
== (<tag>)
But there's no generalized ENVELOP.
"Envelop by Example" Seems Like an Important Construct
>> something: 1020
>> word: 'something ; demo behavior when unbound (binding from context)
>> envelop '[] word
== [something]
>> envelop '() word
== (something)
>> envelop '@[] word ; would work with sigil-decorated types
== @[something]
>> envelop '(()) word ; could work with nested envelopes
== ((something))
There's a big advantage in passing in a block or group "by example". It means you can implicitly pass along a binding, which can be integrated in the same step...if that's what you want. (The modern art of writing Ren-C code requires a lot of consciousness about the decision to use bound or unbound material.)
>> eval envelop '(()) word ; quoting means no binding
** Error: something not defined
>> eval envelop $(()) word ; if binding passed in, it's used
== 1020
ENVELOP might even support Synthetic Asymmetric Delimiters
>> envelop '(| |) word
== (| something |)
>> envelop '(|) word ; shorthand--assume paired?
== (| something |)
>> envelop '(<*>) word ; maybe not assume, for COMPOSE marker compatibility
== (<*> something)
ENGROUP and ENBLOCK Still Useful
I do think that ENGROUP and ENBLOCK as specializations of ENVELOP turn out to be what you'll use at least 90% of the time...so they're worth having around.
But as arity-1 functions, the returned block or group would be unbound at its tip. So you'd have to use the ENVELOP-by-example to pass in a binding.
This Overlaps the MORPH Proposal Somewhat
MORPH has the ability to change the decorations on the value you're passing in, whereas ENVELOP would assume you wanted the item as-is, just enclosed in some other stuff.
My instinct is to say that this takes the pressure off MORPH to be all things to all people... vs. the idea that we don't need ENVELOP and it should just become a subfeature of morph. But I dunno.