Greets,
I've pushed a new branch to the ASF Lucy repository, `method-imp-names`, which
addresses a design flaw in the naming conventions for Clownfish method
implementations.
The new-style names add the suffix `_IMP` rather than rely on capitalization.
Before: prefix_Foo_do_stuff
After: Prefix_Foo_Do_Stuff_IMP
The biggest advantage of the change is that there will now be a clear
distinction between the (static inline) method invocation function
`Foo_Do_Stuff` and its (concrete) implementing function `Foo_Do_Stuff_IMP`.
Previously, it was easy to type the name of the implementing function
`Hash_store` when you meant to invoke vtable-dispatch via `Hash_Store`,
spawning a nasty hidden bug.
A second benefit is that grepping the code base for a method name like
`Foo_Do_Stuff` will now find the implementing function `Foo_Do_Stuff_IMP`.
Previously, such a grep would have missed "Foo_do_stuff" unless the search was
case-insensitive.
A third benefit is that all the Clownfish-generated symbols relating to a
method now follow a more consistent naming convention -- they all append a
suffix.
Pfind_VisGraph_Add_Node // method invocation
Pfind_VisGraph_Add_Node_IMP // concrete implementation
Pfind_VisGraph_Add_Node_OFFSET // vtable offset
Pfind_VisGraph_Add_Node_OVERRIDE // host wrapper
Pfind_VisGraph_Add_Node_t // typedef
I plan to make one more naming convention change: use an all-caps PREFIX
for method names rather than a mixed case `Prefix`.
PFIND_VisGraph_Add_Node
PFIND_VisGraph_Add_Node_IMP
PFIND_VisGraph_Add_Node_OFFSET
PFIND_VisGraph_Add_Node_OVERRIDE
PFIND_VisGraph_Add_Node_t
Rationales:
* Only require the user to grok two variants of the parcel prefix (`prefix`
and `PREFIX`) rather than three (`prefix`, `Prefix`, and `PREFIX`).
* Increase the visual distinction between dynamic methods and inert
functions.
* Allow users to specify parcel names which have only lower-case or only
upper-case letters.
I also plan to change an implementation detail of CFC -- I don't think
CFCMethod should "inherit" from CFCFunction any more.
In the branch, I have transitioned the Clownfish runtime to use `_IMP`
suffixes, but have not yet updated the Lucy core. This change will create a
fair amount of superficial churn -- so if there are any branches which should
land on master before I work on the Lucy core, I'd appreciate a heads-up.
Marvin Humphrey