Checking function parameters in Phobos

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Nov 20 12:19:26 PST 2013


20-Nov-2013 22:28, Dicebot пишет:
> I also think this is very powerful and under-explored approach but it
> really better belongs to certain domain framework than to stdlib. One
> example I keep thinking about is to re-declare vibe.d string functions
> in terms of EscapedString!(SQL), EscapedString!(HTML) and so on for
> better application safety and correctness. No idea how that may work in
> practice though.

I think the obstacles are mostly:

1. There is a non-zero intersection between validated subsets. Some kind 
of NiceStringWithNoPunctuation fits practically every 
EscapedString!(XYZ). There must be a way to cascade and mix/match these 
classes.

2. Template bloatZ! It would be real hard to fight the IFTI duping 
functions bodies behind your back. Or if you dumb down these escaped 
types to not fit the most of templates, it may become a usability problem.

3. This kind of thing is viral. With escape hatch though, it may be done 
step by step.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list