[Pitch #2] Build-Time Constant Values

I remain unconvinced that simple lookup tables such as the example in that NIO patch require const. In fact - I'd go further - if we continue to refuse to address this in the optimiser and require const for static data, it would be actively harmful and a serious expressiveness regression even from C.

I keep seeing it thrown around and taken for granted that const will solve this issue. The fact that these tables are not currently statically initialised is a compiler deficiency, not a language deficiency (see here).

And yeah, the compiler has some sort of super-linear behaviour for array literals. Compiling an IDNA mapping table with ~9000 entries takes >75GB of RAM and has to be killed, but splitting it in to 90 sub-arrays of 100 elements each takes 100MB of RAM and completes in an instant.

Again, that's another compiler deficiency, not a language deficiency. I find it highly, highly concerning that (AFAIK, across multiple threads on this forum where others and I have raised the issue), that distinction is not being made clear. It causes me to question whether the compiler team understand the issue we're all having here.

I don't think this is what NIO needs to fix its lookup table problem (or what WebURL needs for its lookup table problem, or what the standard library needs for its lookup table problem). I hope the compiler team, and the core team who evaluate this proposal, are fully aware of that.

8 Likes