Almost exactly 3 years ago, the first Ren-C function derivation mechanism showed up: SPECIALIZE.
And with it came a question. What would the HELP for such functions say? The HELP string for PICK had historically been different from the help string for FIRST, and now FIRST was just a specialization of PICK.
Under the tentative name "REDESCRIBE" an idea was sketched out for updating just the parts of a function spec that you wanted to change. It took two arguments: a BLOCK! (that looked like a subset of an ordinary function spec), and a function to mutate the description of. Which could be a specialization, or not:
first: redescribe [
{Get the first item of a series if available, otherwise NULL}
](
specialize 'pick [picker: 1]
)
Concerns About Copying Parameter Descriptions
Early Ren-C development feared increasing the number of cells in code by too much. So if you had a function like APPEND which took 7 arguments and refinements, then making a "meta OBJECT!" which captured that as a mapping from parameter to object would be 7 cells of storage (rounded to 8 in a pool).
This object would be convenient and save people from having to parse the spec block to rediscover Rebol's interpretation of the information to implement HELP. And by making it a FRAME! it could use the function's own parameter description array as its "keylist" (a fundamental trick used by Ren-C), so it really would only be the 8 cells...not 16.
Then, if you run the code to create a function and then don't run it again, the original BLOCK from which the parameters were created would be GC'd. Assuming you had a description for every parameter (more or less) you'd pretty much break even.
How Many Copies in a Derivation?
If you derive functions like FIRST, SECOND, THIRD, all the way through TENTH off of PICK, then should each one have a duplicate of PICK's information? Or is it enough to have meta information that points and says "FIRST is a specialization of PICK", and then follow that link through to get the parameter descriptions from PICK?
Plus, having the meta information say "FIRST is a specialization of PICK" may provide useful knowledge.
Oh, what a tangled web...
This led to the existence of dig-action-meta-fields and other rather convoluted code. Every function that wants to do surgery on the HELP information gets burned by it. And if you ever do want to do surgery, you have to flatten it all anyway. Not to mention that it's only an object the size of the parameter cells involved...the actual description strings can appear multiple places without being copied. And if someone changes the help information on a base function, it will change the help information on derived functions--which you might want, but you also might not.
Because the routines were complex and early in the bootstrap, they have been good examples of generalized Rebol code that has had to weather core changes. It has been educational to have them. But the complexity represented gets in the way of the most basic things people want to do with manipulating HELP on derived functions...while not truly providing the intended value.
New Plan: Fundamental Derivations, Flat Help
Rather than investing deeper in this tangential design: help information will now be flat. The META information will be captured from the function being derived from at the time of function creation.
But to make things easier to understand, the derivations will be userspace code. Fundamental operations which do not create any HELP or META information at all will be available as SPECIALIZE*
, ADAPT*
, CHAIN*
, ENCLOSE*
, AUGMENT*
. Performance-sensitive code (or functions that aren't meant to have their own HELP) can use these, and avoid the overhead.
As for being able to tell how a function is implemented, that seems to be a problem for SOURCE. We'll have to work on the rendering there to make that informative enough to show you that something is a CHAIN or a SPECIALIZE-ation of another function. That seems the right place to be conveying the information.