Automatic refactoring: construction calculus or (quote) or scanning source code
Reading https://ianthehenry.com/posts/quote-unquote-macros/ made me want to comment on the futility of reflection in programming languages.
Recently, I was making HTML templates in PixivFE function at compile time. You may ask, why don’t I use a type-checked templating library? Well, for this project, I didn’t make the choice.
Let’s say you have code like c.Render("template_name", map[string]any{<template_data>})
littered all throughout the source code. How do you make this type checked? Note that each HTML template has its own template_data type.
Different languages offer different solutions to this.
Zig: Just type more :) You can’t have too much types :)
Janet: (def-macro awawawawa)
And there are languages who proud themselves in limited flexibility.
Go: https://github.com/golang/go/issues/61796
You can circumvent this limitation by scanning the source code.
You may say that Go has go generate
. No, I refuse. I just want to write automatic tests, not half of a static analysis tool.
If the language is Jai, then, maybe scanning the source code takes not too much development time to be worth it. Go? No. It’s not a language that empowers the language users.
1 how do i grammar this?