The Humble Suffix (LLO Archive)

Created 2025-12-01, last modified 2025-12-01

Part of my archive of Layover Linux Official posts on Tumblr.


2025-10-05

Been a migrainey weekend, but I'm making some progress. I have modifiers working for number literals. If you've caught a flavor for Prone's design sensibilities, it won't surprise you that this is just more syntax sugar for "call a function on it," and you can customize behavior by setting things in scope.

prn> 5u8
u8(5)
prn> 5list
[#LITERAL_NUM, "5"]
prn> 5repr
'literal.num("5")'
prn> u = u8
conv.fn(conv.u8)
prn> 5u
u8(5) 

It should be pretty to implement this for strings too, although the demand right now is less. For numbers, at least, this parses as:

[#LITERAL_NUM, "5", #u8]

This is the normal literal num convention, but with an extra atom tacked onto the end. Representing this in a distinct way from u8(5) matters, because code formatting is just parsing a piece of code and then doing a particular form of pretty-printing on it. If we just immediately turned that into u8(5) at parse time, this would cause automatic formatting to "correct" modifiers away.

Additionally, in my recent parser updates, I had something sketchy going on, where I was using zero as both a failure value AND a valid initial position. This was dumb, and I got away with it for a little while, but it was probably causing the crashes @rust-official was experiencing, and also, I couldn't parse these new number formats at position zero without fixing it. While I was in there, I also corrected an organically evolved practice where the TRY macro (used to return the first valid match) had some opposite needs of the CHAIN macro (match another token in immediate sequence). Now these work the same way, with the same setup, and it's just one less thing to spend brain on.

Anyways. It's nothing flashy tonight, but it's incremental progress making something I'm proud of.