[fpc-pascal] IfThen() intrinsic removed

Lukasz Sokol el.es.cr at gmail.com
Fri Feb 5 11:50:54 CET 2016


On 05/02/16 10:35, Andreas wrote:
> 
> On Fri 05/02/2016 07:49, Lukasz Sokol wrote:
>> That it's C, not Pascal ;) and, um. sorry I do not have a c spec on hand, 
>> does it really work that way in C - only evaluates truevalue or falsevalue not both?
>>
>> I wrote another one in another email, maybe actually having new keyword or 2 is ok ?
>> and require it to be an assignment, like
>>
>> x := ( condition; whentrue:=true_value; whenfalse:=false_value);
>>
>> so syntactic sugar but not abusing function calls, but an assignment instead.
>>
> Well then how about: x *:=* *when* condition true_condition *otherwise* false_condition;
> 
> How this is pascalish.
> 
Smells, like perl or python... I almost wrote the 'when version' but... ;)

without clear indication that a value is returned, it's like a statement... 

Any other imaginative way to indicate that a construct returns a value, other than using braces...?
as 'just braces' will confuse people using _() a lot.

(side note : 
x := (when condition use truevalue otherwise falsevalue); 

looks more like : keyword before expression template; needs 3 keywords however. and still looks like a statement...


) 

> Andreas
> 
el es





More information about the fpc-pascal mailing list