text based file formats

Adrian Matoga dlang.spam at matoga.info
Tue Dec 20 21:51:12 UTC 2022


On Sunday, 18 December 2022 at 16:12:35 UTC, rikki cattermole 
wrote:
> > * make it @safe and pure if possible (and its likely possible)
>
> pure is always a worry for me, but yeah @safe and ideally 
> nothrow (if they are forgiving which they absolutely should be, 
> there is no reason to throw an exception until its time to 
> inspect it).

I frequently find it useful for a text data file parser to call a 
diagnostic callback instead of assuming some default behavior 
(whether that's forgiving, printing warnings, throwing or 
something else). With template callback parameters the parser can 
throw if the user wants it or stay pure nothrow if no action is 
required.


More information about the Digitalmars-d-announce mailing list