ryanlaws / pigeons

Message logistics for monome norns
2 stars 2 forks source link

Rethink lenses #11

Open ryanlaws opened 3 years ago

ryanlaws commented 3 years ago

Summary

Reconsider lenses: why they're good, what they could be, what they are and how that could better serve the idea.

Why

The implementation of lenses is a hacky mess right now. It does not do justice to the idea.

Considerations

ryanlaws commented 3 years ago

Why not just really go all in on plisp and properly use that for lenses? Could identify "reversible" operators to trace the steps backwards. offset and range are a simple declarative form of this which might not be a bad approach, but limits expressiveness. Which tactic scales better is an important concern, but maybe less significant with e.g. DSLs.

ryanlaws commented 3 years ago

One easier fix would be better handling of n and v for MIDI types. For example, program_change doesn't have a v and e.g. clock doesn't have either. I think a simple lookup table, i.e. one for types with v and one for types with n, would be a pretty easy fix.

Longer-term, it's likely we need different lens strategies for different protocols. Like, a MIDI-specific one, and then one for e.g. grids, crow, whatever else comes down the pipe. These could surely be injected somehow.