[fpc-pascal] New feature: IfThen() intrinsic

Michael Van Canneyt michael at freepascal.org
Mon Feb 1 13:09:17 CET 2016



On Mon, 1 Feb 2016, Maciej Izak wrote:

> 2016-02-01 11:28 GMT+01:00 Sven Barth <pascaldragon at googlemail.com>:
>
>> I have to admit though that I forgot about the potential problems due to
>> refactoring. I'll change the name to avoid this pitfall, though I've yet to
>> decide which one.
>>
>
> My proposition is:
>
> function &if(Condition: Boolean; ThenExpr, ElseExpr: type): type;
>
> & is used rarely (and it is legal ident part), collision with existing code
> base is minimal. Looks almost like regular Pascal syntax ;).

No. The compiler already uses &.

& means 'the following is an identifier even if it is a keyword'.

You can perfectly declare and compile:

Var
   &if : integer;

begin
   &if:=1;
end.

So &if is a bad idea.

Michael.



More information about the fpc-pascal mailing list