zopsicle / raku-nix

Build Raku modules with Nix! Also includes Nix derivations for community modules from CPAN and GitHub.
9 stars 3 forks source link

s/::/-/g is not round-trippable #11

Open ugexe opened 4 years ago

ugexe commented 4 years ago

- is valid in an identifier, and thus it cannot 100% reliably be used to normalize names. -- is not a valid identifier, and thus s/::/--/g is technically the superior naming convention.

Admittedly the former is more common in other languages than the later. But that dichotomy would appear to be because its more common to now allow - in identifiers.

I don't know if the round-tripping actually matters for you, but the - issue still remains since querying for literal Foo-Bar module should not find a Foo::Bar module.

zopsicle commented 4 years ago

I’m not concerned that this is a practical issue. In fact the Nix infrastructure for Perl 5 entirely omits ::, so JSON::XS becomes JSONXS, and they seem to be doing fine. :)

ugexe commented 4 years ago

they seem to be doing fine

I guess. But consider that at least 50% of the people who have already commented in this issue would be affected by that perl naming convention, so how practical an issue that is may depend on who you are.

https://metacpan.org/pod/Text::Levenshtein::XS https://metacpan.org/pod/Text::LevenshteinXS

zopsicle commented 4 years ago

I just realized no mangling should be necessary at all for the attributes on raku-nix, since we can simply double quote all the names, like we already do with if. You would write raku."Cro::HTTP".

Mangling is still necessary for derivation names, but those are not semantically important anyway. They are purely informational, to quickly identify Nix store paths.

The ones that are already there (default.nix is still small since I don’t generate it automatically yet), I will keep for now as aliases, for backwards compatibility.