On Tuesday, 27 March 2018 at 12:11:58 UTC, Guillaume Piolat wrote:
- ability to write file during CTFE is not necessarily positive. THough I can't tell why from the top of my mind.

Only thing I can think of is that 3rd party modules can end up writing to your file-system during compilation and could potentially access data etc. they're not allowed to.

That is because you may invoke your compiler with the highest permissions possible, but not necessarily the compiled binary file.

Which means that the compile-time may not have any restrictions at all and thus potentially security holes are open.

Whereas the run-time will be limited and restricted.

However by allowing writes etc. at compile-time then the restriction at run-time suddenly doesn't matter, because libraries can just do what they want during compile-time and you don't really want to limit the compiler's permissions etc. because some things may be needed at compile-time that aren't necessarily things you want your run-time to access.

I don't know if that makes sense though, but I tried to explain my reasoning as much as I could.

In my eyes, it's definitely a no-go to allow writes at compile-time, especially without restrictions. (I don't know if Nim has any restrictions, but doesn't sound like it.)

- AST macros are not necessarily easier or more tractable, which have been argued repeatedly by Walter in these forums. The avoidance of AST macros is a plus, not a minus.


Sometimes it's much simpler to use mixins, mixin templates etc. than constructing AST nodes.

I think this really comes down to taste.

However AST nodes seem to be more flexible to manage, but they also open up a lot of complexity.

I guess there is no real answer to that, as it'll always be a biased answer.

Reply via email to