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
Overwrite units #293
Comments
Some other solutions:
|
I want to be able to swap easily without interacting with command line
This isn't very seemless Not to discredit these suggestions (specially the first), but if its feasable and easy enough to overwrite units, it would be a nice restriction to have lifted |
Sure, overwriting units is still a feature we should consider. But in the meantime, I wanted to share some possible workarounds |
I echo @SollyBunny . I want to replace the default definition of electric-resistance "ohm" as its short-form "Ω" is nothing easy to type BUT I want to keep the rest of all these nice defaults. I don't want to copy entire defaults just for my single tweak. |
Normally you can get the ohm symbol by typing |
@eminence Still, to me as an electronics engineer, I'm fine to use "ohm" as a short-form of resistance and that's 3-key-type (where "\ohm" + TAB is 5-key-type) :-P Appreciate to implement "unit" overriding feature. |
I don't quite understand. You can already use Overwriting units is only needed if you want to change the actual unit definition. |
@SollyBunny I'm not questioning that it might be useful in some cases to overwrite units. But so far, I haven't seen a compelling use case. Can you go into a bit more detail what kind of changes you are thinking of?
planck_length is already defined as Footnotes |
Yes, but at the time of parsing of the definition, it is set as stone when h_bar is Someone pointed out I can just disable prelude, but that is not very seemless, I'd like you to be able to change it. The unit could be evaluated every time it is used so if h_bar changes the unit changes dynamically with it, but I'd like it just to be possible to overwrite the units |
Thank you for the clarifications. I think those are reasonable requests, and I actually thought about this a few months ago here: #86. Maybe that
That might be required because Numbat is statically typed. Imagine sth like:
Implementing this proposal might actually not be too hard (I think we need to lift a restriction somewhere), but we should properly test it and think about potential pitfalls. |
I'm trying to make a module which makes numbat align with an exam board's constants
Constants can be overridden but not units, this restriction is quite annoying
This is probably like this so functions don't break, this can be fixed a number of ways:
The fact you can't overwrite units also means that if you define a unit, you're stuck with it
The text was updated successfully, but these errors were encountered: