What should happen when the assert message expression throws?
Dennis
dkorpel at gmail.com
Thu Nov 24 09:32:23 UTC 2022
On Thursday, 24 November 2022 at 08:23:22 UTC, bauss wrote:
> Format strings could come from user code
Can you name one application that does this?
> This is especially important in applications that can have
> multiple users interacting with it at the same time ex. a
> website, game server etc.
I've never seen a website or game ask me to input a programming
language-specific format string.
> If it should be an error then there should be a way to validate
> a format string at runtime without attempting to call format.
Yes, I agree.
> Error should only be used for errors that aren't recoverable
True, but what you consider recoverable is a subjective design
decision.
> ex. out of memory
Can be recoverable. If I try to render a scene in Blender that's
too complex for my GPU, it reports 'out of memory' without
closing the program.
But considering out of memory is unrecoverable by default in D,
you can get in trouble when the user gives you a format string
that generates very large output, such as `"%2000000000s"`, so
currently it's not safe to use format strings provided from user
input anyway.
More information about the Digitalmars-d
mailing list