Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postfixes instead of libra operators #14

Open
alabamenhu opened this issue Sep 10, 2019 · 1 comment

Comments

@alabamenhu
Copy link

commented Sep 10, 2019

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.

@p6steve

This comment has been minimized.

Copy link
Owner

commented Sep 12, 2019

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 ♎️ or something more general where there are non-SI units (my current set is approx. 250 - see the bottom of Unit.pm6).

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!

~p6steve

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.