insect icon indicating copy to clipboard operation
insect copied to clipboard

Not recognizing `mi` as an identifier

Open alichtman opened this issue 6 years ago • 5 comments

image

Is this a bug? Or is there some reason that "mi" isn't recognized as input but is used as output.

alichtman avatar May 01 '18 04:05 alichtman

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?

sharkdp avatar May 01 '18 08:05 sharkdp

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.

alichtman avatar May 01 '18 09:05 alichtman

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:

sharkdp avatar May 02 '18 19:05 sharkdp

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.

alichtman avatar May 03 '18 07:05 alichtman

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.

hallzy avatar Oct 17 '20 17:10 hallzy

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.

triallax avatar Jan 08 '23 23:01 triallax

This is now resolved in Numbat: https://numbat.dev/?q=97.5+yd+-%3E+mi

sharkdp avatar Sep 20 '23 11:09 sharkdp