General question about layer IDs

Why are layer IDs sometimes different?

Such as:

Is this an indication of something wrong?
Is it possible or beneficial (for some reason) to keep/reassign these all into a consistent format?

All is well. The layer ID of a master layer is the same ID as the ID of that respective master. The long IDs are used for other layers (for example, backup layers).

There is no benefit to longer or shorter layer IDs. IDs are only used internally and never part of the exported font.

I would greatly appreciate a more consistent use of master IDs across Glyphs. It is extremely annoying to write certain scripts otherwise, especially for automatic special layer management in fonts where new masters are added or others are removed.

You should never type those IDs. Always get them from the objects. Consider them an opaque type.

Can you give an example where it is annoying?

I think I might have mixed something up in my tiny brain. The annoyance I was remembering concerns “a01”, “a02”, etc. (or something like that) instead of axis IDs when writing the Layer.attributes for intermediate or alternate layers. Removing (or adding) axes with a script makes this highly strenuous, as you need to update the number in each string in the attributes dictionary to point to the right axis. Using the axis ID instead completely circumvents the problem.

I can’t come up with a case where m01, m02 etc. has annoyed me so far, but I’m sure there are similar possible cases.

There is this post about Incorrect Master IDs: