4 ms·
This idea of a separate phase modifying your input is really powerful, and I think more languages should design their syntax around that idea. A nice example c
by ridiculous_fish 4y ago
This idea of a separate phase modifying your input is really powerful, and I think more languages should design their syntax around that idea.
A nice example comes from AppleScript of all places. You can close a block with just `end`, or by referencing the opening like `end if`. When you save a file, the compiler rewrites all the `end`s to the second form.
Any other examples where the language is designed to be enriched by tooling?
- chrismorgan 4y agoI’ve been designing a new lightweight markup language for the past few months, and I have decided to take this approach for things like typographic punctuation: rather than the markup language engine embedding fallible heuristics (turning ' into ‘ or ’, based on the natural language’s usage) or annoying ligatures (e.g. TeX has -- → –, --- → —, ` → ‘ and ' → ’), I will provide a linter that provides flexible rules for such transformations and the ability to perform in-place replacement. This linter will also be able to perform source autoformatting of various kinds, e.g. visual alignment of list indentation and table columns, and it’ll be hooked into LSP so direct text editor integration is possible.
- danaugrs 4y agoI'm building a language (https://flame.run https://flame.run) and trying a similar idea for imports. In my language there is no package manager. Files just import other files, locally or from URLs (like Deno). But, unlike Deno, I'd like to store the hashes of the imported files for security. I don't want to create a secondary file a la package.json, or even two files like go.mod/go.sum. So the idea I'm probably going with is that whenever you run/compile a program the tooling warns you and asks to insert the missing hashes of the imported files for you, inline.