Coding 2024-09-19

By Max Woerner Chase

I didn't turn on my computer until way late tonight, so I'm going to quickly talk about code I could write soon, rather than try to actually write it.

I'm still leaning towards using BEM for CSS. Now, the SCSS source for Three Dollar Quill doesn't quite adhere to BEM practices for a few reasons (one is that I have to write the code to work with HTML that I can't figure out how to easily control the generation of, another is that I was lazy and stuck everything in a single monolithic file). I will be again doing something weird, but for a different reason (I want to avoid setting up an asset pipeline, so I'm going to try to generate CSS in Python instead of Sass (although, for what it's worth, I could invoke Sass bindings from within Python...))

Anyway, all of that means that I think it would be neat to give Blocks and Elements a kind of programmatic identity. Like, here are the blocks, here are the associated elements, here are the modifiers they can take. And render them into various combinations. In class attributes, "here is a block or element, and a set of associated modifiers". In CSS...

My heart keeps on wanting to represent the class attribute case with a flag enum, which I think indicates that there's something a bit wonky with my heart.

Like, there'd be two Flag subclasses that handle some behavior, and the Element one would need a reference to a subclass of Block, which means it's time for me to bust out the generic enum metaclass again.

:)

🎉

Anyway, all of the CSS cases would require contracts on the length of the instance.

At this point, I've thought about this enough that I really want to try it to see what breaks.

Anyway, it's super late, time to get to bed.

Good night.