rejectedsoftware / diet-ng

Compile-time indentation based, XML structured template system
MIT License
45 stars 24 forks source link

Don't pass entire file contents as template parameter #69

Closed schveiguy closed 5 years ago

schveiguy commented 5 years ago

This explodes all the symbols inside to huge amounts as the file contents become part of the symbol (and all nested symbols). Not sure how much this will reduce the resulting footprints, but definitely worth looking at. At least compiler errors and exception traces will look more reasonable.

s-ludwig commented 5 years ago

I also noticed that this seems to have slipped in again, although I'm pretty sure I fixed it at some point by passing an alias to a static immutable global. Do you know off hand which template has that issue?

schveiguy commented 5 years ago

Ah, OK. I misread the fact that it is an alias and not the string itself. Are we sure that aliases to a static immutable string don't translate into the string itself? I know I have had cases when developing a new feature for diet-ng that I have seen stack traces or compiler errors (can't remember which) where the entire contents of the file are displayed as part of the symbol. But that could possibly be because I'm passing in the string directly to compileHTMLDietString? I don't actually know. I'll close for now, unless I can prove otherwise.

s-ludwig commented 5 years ago

I'm also unsure where I saw it, but I also did see it (it could have just been an old diet-ng version, though). Unfortunately it doesn't seem to occur for normal errors, so I guess this has to rest until it shows up again.

s-ludwig commented 5 years ago

Okay, just got an error message citing the whole source code. In fact it's not a template instantiation, but a CTFE call stack that lists all function arguments as stringified expressions. It can be fixed by using static immutable for the input file array instead of enum.

schveiguy commented 5 years ago

Nice! Yeah, I forgot to come back to this, I saw it also, Seems to happen when you have a syntax error in your diet file that causes the diet parsing to fail.