Closed ofelas closed 6 years ago
This problem exists for integer literals as well:
printf("{}", 5);
yields
error: parameter of type '(integer literal)' requires comptime
@zesterer
That isn't the issue presented here. Comptime literals are stored as arbitrary-precision values in the compiler (floats are stored as 128-bit right now). In order to print these, we would have to either bundle compile-time integer support into a runtime or serialize to a string at compile-time which are both fairly untenable as they require a lot of extra machinery/memory that is rather implicit. For this reason we just emit an error (which is a little unhelpful).
I've made a proposal to discuss 'solving' this here: #747.
Demonstrated with the following snippet. Tested with version 0.1.1.4e3d7fc.