charon icon indicating copy to clipboard operation
charon copied to clipboard

Compute short names of items

Open Nadrieril opened this issue 1 year ago • 5 comments

Items in the pretty output have fully-qualitied names that are hard to read. We could compute for each item a shorter name that is guaranteed to be unique across the whole llbc output, and use that shorter name when displaying to the user.

Nadrieril avatar Dec 10 '24 14:12 Nadrieril

As discussed: I believe this is a good idea. There is just one thing which is not clear to me: do you intend to compute a short name for all names, or only for a small selection of the most common ones (such as Box)? As a side remark: of course, we will need an option to print the full names - in my case, I often write name patterns by looking at the debugging output, but those can only be derived by looking at the full names.

sonmarcho avatar Dec 11 '24 10:12 sonmarcho

I intend this for all names. I also intend for the name matcher to optionally work on short names (and raise an error if there could be ambiguity).

Nadrieril avatar Dec 11 '24 12:12 Nadrieril

We can also easily add an option to print full names, or add a map from short to full names in the llbc output.

Nadrieril avatar Dec 11 '24 12:12 Nadrieril

I intend this for all names. I also intend for the name matcher to optionally work on short names (and raise an error if there could be ambiguity).

Ok, understood. A small remark for the name matcher: I think it would be good if the patterns are stable, which would not be the case if we allow matching by using short names (as adding a dependency to a crate might introduce ambiguities, making some previously succeeding patterns suddenly fail).

sonmarcho avatar Dec 11 '24 12:12 sonmarcho

Agreed, hence why "optional". I also think short names are a lot more convenient when prototyping so it's a good option to have.

Nadrieril avatar Dec 11 '24 12:12 Nadrieril