Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Postfixes instead of libra operators #14
The idea of the libra operator is interesting, but I think particularly for this type of a module where the information is fairly simple (that is, /+ +/), using postfixes might work better on top of being more easily typed (or at least as an addition). See https://codereview.stackexchange.com/questions/159150/mass-and-length-calculator-using-perl-6-custom-operator/227804#227804 for an example.
If you're ammenable to it, I'd be happy to work it up and submit a pull request.
Hi @alabamenhu - thanks for the link to stack exchange and the idea on postfixes. I think that this is fantastic! I would love to see a pull request on these lines and, to be honest, I think that the libra operator is a bit awkward. I think we will need to keep
In your workup, I propose that you focus on SI - and we can maybe call your module Physics::Measure::SI. It could be lib/Physics/Measure/SI.pm6 if you are OK with that and use Physics::Measure (which in turn will use Physics::Measure::Unit, etc).
My core units are a bit different from pure SI, you may want to take a look at Unit.pm6 line 788 down at 'core'. I can see this for m, kg, s, A, K, mol, cd - that's probably a good place to start, I leave it to you to figure out the k of kg. I imagine quite a repetitive section of infix lines - maybe a generator script would be handy?
Hopefully you will be able to get things like Area, Speed, etc. working as needed. Once we have that running, I can maybe do a :SI adverb on Physics::Measure to speed things up!!
Happy to help in any way!
PS. I am currently rewriting Units.pm6 to be more comprehensible / maintainable. If you interface via Measure.pm6 that should all work fine come integration time.