3 ms·
I really like the idea of a general-purpose text-replacement pre-processor like this. I especially like: - A "real" programming language (Scheme) - Only 1 cha
by chriswarbo 10y ago
I really like the idea of a general-purpose text-replacement pre-processor like this. I especially like:
- A "real" programming language (Scheme)
- Only 1 character to avoid/escape (~)
- Expression-oriented (as opposed to, for example, impure echo/print)
- Completely orthogonal/independent of the code being manipulated (unlike the myriad Java/JVM examples cited by other comments)
One thing that would be nice is to distinguish between pure expressions and impure ones. That way, pure expressions can always be processed automatically (e.g. in wrapper scripts around tools like static analysers) since they're incapable of performing any effects.
Impure expressions would still be useful, e.g. to scan filenames in the current directory, but can be identified as such and skipped by tools/scripts.
- ruste 10y agoHmm, I think it's a dangerous thing to be skipping portions of code in analysis just because they're impure. I think you'd be better off just taking the code produced after processing and running that through your static analyzer as is. That's what's going to be running in the end anyway. Maybe I'm not fully understanding the problem though.
- chriswarbo 10y agoWell, you could choose to abort rather than skip anything. The problem is that impure code can do dangerous things (depending on which i/o primitives are provided). For example, a macro might create and delete a bunch of temporary files; this might work fine in one scenario (e.g. during compilation) but misbehave during another (e.g. static analysis). In which case "static analysis" would no longer be static.