Open ab5tract opened 2 months ago
Feels to me an implementation of desired functionality in module space, would be a first step?
Feels to me an implementation of desired functionality in module space, would be a first step?
Hmmm.. I'm not sure how successfully some of the issues can be addressed without NQP and/or VM changes.
But it's a good idea for ironing out the actual replacement Raku API nonetheless.
The Problem
Raku currently very lightly wraps internal
NQP
and VM operations for:uniprop
)uniname
/uninames
)unimatch
)uniparse
)unival
)As currently implemented, these routines -- methods and subs alike -- do not perform their functions as well as they could.
Issues
uniprop
will return 0 if the property provided is not found. This would be better served with aFailure
orException
, or at the very least an empty string so that the return type is consistent.'Properties' and 'Property Categories' are served via the same mechanism, even though they are only interchangeable from category to property and not the other way around.
All of the methods which take properties could fail at compile time when provided with known nonexistent properties (ie, not stored in a variable).
Properties are returned from NQP with spaces separating words, but only
_
separated property names are accepted going the other direction.The current implementation is not [thread-safe](https://github.com/rakudo/rakudo/issues/4871). See also at [the MoarVM level](https://github.com/MoarVM/MoarVM/issues/1717).
There are separate methods for "first character" (
uniprop
/uniname
) versus "full string" (uniprops
,uninames
). It feels far too Perl-ish at this point to accept a multi-character string as an argument that only operates ona single character.uniprops
to return a comprehensive list of applicable properties for a single character? Currently there is no way (that I am aware of) to get such a comprehensive list.(Nit-level deficiency)
smashedtogetherlowercase
is an ugly (at worst) or a non-conformant (at best) naming scheme.The solution
The instructions for
problem-solving
state I'm not meant to spend any space on this in the initial post.So for now, I'll just mention that -- at the HLL level -- I think we could achieve all current functionality as well as much more out of even a single method that utilizes adverbs.