Comment by nine_k

2 years ago

Why cursed? Why a neat CSV file can't serve as a part of the source three, while a much more cursed pass with `cpp` to handle `#include`, `#ifdef` and such is seen as okay, even e.g. in the Haskell community?

Well, first off, I don't think those things in haskell are good, really. They are/were necessary because of various _other_ issues, but they are not "good" features. And e.g. template haskell doing arbitrary IO at compile time is famously a cause of a variety of unintended problems (e.g. can't cache correctly if you never know what things a TH-module depends upon, very hard to cross compile if you can't be sure the arbitarary TH logic isn't depending upon the compilation host architecture to make some decision for compilation target, etc)

Specifically though for Shen, what causes me pause is how frequently this kind of "call an arbitrary term-level function in the type system" is done; it is quite frequent, and thus all my mental alarm bells sound. Debugging issues that arise in things like this can be quite challenging.

Sharp/dangerous tools are often necessary, but what I find unfortunate is that you need to use those sharp tools constantly, when a safer tool could do just as well!

  • I agree in general, and with the idea that effectfullness of compile-time calculations should be strictly limited.

    OTOH reading an input file is one effect that a compiler inevitably has anyway. A clean way to load and interpret an input file as a part of comptime computation would be very helpful, without the problems of arbitrary effects.

    • Yeah imo the way this would be handled ideally is that some other program would generate a source file from the csv. That source file can then be included normally and work with existing caching infrastructure etc.

      But ya know back when make was the way of doing things this would be easy to set up. Now in the age of each tool having its own build system it is different.