Re: type string

new topic     » topic index » view thread      » older message » newer message

>I tried with a direct return statement, but short-circuit evaluation only
>works for if and while statements. I understand that short-circuit may
>render unwanted results for general purpose boolean operations, but in the
>context of a type declaration, where only true/false values can be returned
>(same case as if and while) there could be a way to override the default
>behaviour. Maybe "with/without short_circuit" keywords could be implemented
>Rob. Or even create short-circuit specific boolean operators: sc_or,
>sc_and, sc_xor.

Its a litle late for special operators now, but I personally found it very
annoying, that in the *one* place where
short-circuiting would make the most sence (in type-check functions) its
implemented. Its all inconsequent.

Types allways check a given value using one or more operators and functions,
that should not have any side-effect.
Within a type function thus, rather than in a 'while' or 'if' statement you can
be certain short-circuiting would *not* brake
the code.

Robert, precizely what are your arguments to *not* implement short-circuiting in
a return statements of type-check functions ?
The only disadvantage I could come up with is the fact that it might be
'confusing' when some 'return' statement do
short-circuit and some dont.
But this really doesnt hold up, return statements of type-check functions are
*the* place where you can be most certain that
short-circuiting is the most wanted behaviour. In a type-check are always
validating a value. In other words: not
short-circuiting is the *unwanted* behaviour.

A much stronger argument for short-circuiting than those used to add
short-circuiting to the 'if' and 'while' statements.

Ralf

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu