Strings and things
Brian Goetz
brian.goetz at oracle.com
Fri Sep 17 12:54:07 UTC 2021
OK, so I guess there is a third interpretation of your comment that I
didn't realize the first time, which is about compile-time _validation_
of the format string, so the user can get errors at compile time. (It
really seemed like you were going for more control over lexing.)
Yes, there is a viable path to this, though we surely won't pave it all
in one go. As we outlined in
https://www.youtube.com/watch?v=iSEjlLFCS3E, we have explored
opportunistic compile-time constant folding. This is complicated for a
lot of reasons, but not impossible. If all the pieces could be made to
line up, then it is theoretically possible that we could get
compile-time validation of the format string. Its a long string to
pull, but its not a dead end like library control of lexing.
On 9/17/2021 8:28 AM, Stephen Colebourne wrote:
> On Thu, 16 Sept 2021 at 19:10, Brian Goetz <brian.goetz at oracle.com> wrote:
>>> I believe however that there is a missing element - pre-processing at
>>> compile-time.
>> The other interpretation is that you are asking for a way to let the
>> library plug into the parser (the lexer, actually!) so that you're not
>> stuck with the language's notion of "string with holes."
> I'm open to any approach that can produce errors/exceptions before
> runtime when the template is invalid (preferably at compile-time). The
> discussion in the doc about safety feels a bit incomplete without
> early validation. Anyway, thanks for the reply.
>
> Stephen
More information about the amber-dev
mailing list