5 karma · joined Jul 24, 2021 (5y ago) · 3 submissions
comment 5y ago · link · parent
(1) In tylr you move the parenthesis itself, rather than making the parenthesized term slurp/barf its neighbors. This may seem like a minor difference for simple operations like this but I think it's an important primitive UI metaphor that makes the editing experience feel more direct/linear/text-like rather than you having to translate your editing goal into operations on the AST.
(2) tylr generalizes beyond S-expressions to infix operator sequences and other multi-sorted syntactic forms (eg it understands you shouldn't be able to move expression forms in patterns).
(3) tylr generalizes beyond parenthesis moving to near-arbitrary range selection moving, eg I could make the selection (specified by the square brackets)
`( 1 + 2[) * (]3 + 4 )`
and directly move it over to give
`( 1[) * (]_ + 2 + 3 + 4 )`
(where tylr has inserted a hole `_` to keep things well-formed)
comment 5y ago · link · parent
It might help to think of restructuring mode, the mode automatically entered upon constructing `(`, as a transactional editing mode in which you specify your AST-to-AST transformation.
comment 5y ago · link · parent