Am Wed, 20 Nov 2013 16:26:59 -0800
schrieb Walter Bright <[email protected]>:

> Utf validation isn't the only form of validation for strings. You could, for 
> example, validate that the string doesn't contain SQL injection code, or 
> contains a correctly formatted date, or has a name that is guaranteed to be 
> in 
> your employee database, or is a valid phone number, or is a correct email 
> address, etc.
> 
> Again, validation is not defined by D, it is defined by the constraints YOUR 
> PROGRAM puts on it.

A checked type for database access goes a bit beyond the scope
of the proposal. You'd need to encapsulate a transaction that
needs to be working on a snapshot of the database state and
fail if data changed in another transaction.
Otherwise you could validate a name against the database just
before someone else deletes it and thus invalidates the string.

With a DB transaction wrapped in the validation, assignment
between two "validated" strings becomes a pretty sophisticated
runtime action, while the original proposals evolved around
validation functions that can be pure. /This allows us to assign
one validated string type to another with no runtime overhead./

-- 
Marco

Reply via email to