insect
insect copied to clipboard
Not recognizing `mi` as an identifier

Is this a bug? Or is there some reason that "mi" isn't recognized as input but is used as output.
I tried to fix this (in the past and again now), but it's really tricky with the current implementation of the unit-parser because (a) mi
is a prefix for minutes
/minute
/min
and (b) m
(for meter) is a prefix of mi
.
I think it could be fixed with some effort, but I'm currently leaning towards changing the output to mile
instead of mi
.
What do you think? Is it essential that we support mi
for mile
?
What about using context sensitive units?
It never makes sense to convert yards
to mins
, but it does make sense to convert to miles
.
Similarly, you'll never convert hours
to miles
, but you will convert to minutes
What do you think? Is it essential that we support mi for mile?
I do think this is necessary to support. It would improve my usage of the tool significantly.
What about using context sensitive units?
Insect follows a philosophy where it does not try to be "smart" and guess what the user intended to do (as compared to "Google as a calculator", for example). It has a very strict grammar which is never ambiguous. At least to me this is a very important property for a mathematical tool whose output I want to trust (I do not want to double-check if it interpreted my input correctly).
I do think this is necessary to support. It would improve my usage of the tool significantly.
Ok, let me try again :smile:
At least to me this is a very important property for a mathematical tool whose output I want to trust (I do not want to double-check if it interpreted my input correctly).
I completely agree, but I think that unit groupings won't be too ambiguous. As long as you input the units you mean to, no "incorrect" conversion is possible, theoretically.
Sorry, I created an issue exactly like this. I didn't find this when I was looking.
Just my 2 cents...
I would also prefer that the units be strict and yell at me when I make a mistake. I would prefer to be told when my units don't match in case I misunderstood what insect interprets my units to be for some reason, or If I make a mistake myself.
I would have no problem seeing the output from insect as 'mile' or 'miles' instead of 'mi' to avoid any confusion.
For what it's worth, this can be worked around by adding this line to ~/.insectrc:
mi = mile
Other than appearing with a different color in Insect's output, this is indistinguishable from supporting mi
natively in Insect.
This is now resolved in Numbat: https://numbat.dev/?q=97.5+yd+-%3E+mi