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

silvioprog silvioprog at gmail.com
Mon Feb 1 21:35:48 CET 2016


On Mon, Feb 1, 2016 at 5:10 PM, Sven Barth <pascaldragon at googlemail.com>
wrote:
[...]
>
> > When you format this code (e.g using Ctrl+D) the result is a very ugly
> > syntax:
> >
> > var
> >   S: string;
> >   B: Boolen = True;
> > begin
> >   S :=
> >     if B then
> >       'A'
> >     else
> >       'B';
> > end;
> >
> > And I think that it breaks compatibility with many Pascal syntax
> > beautifier. IMHO Iif() (or something like this) sounds better.
>
> I honestly don't care about syntax beautifiers, like at all. Most are
> already broken for ObjFPC anyway.


But if it will be done using some syntax like this, it should use an
additional identifier (inline, as it has been suggested). Anyway, this
Pascal abbreviation sounds very strange, "if B is true, so A, else B". I
can't see it in other place. :-D Usually we listen something like "if B is
true, so something get 'A', otherwise something get 'B'".

You can extend the ObjFPC syntax adding this new abbreviations to make it
more Pascal keyword style, but please keep some function like IfThen() (or
something like this), it is very useful for who that already use it from
other many languages.

-- 
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160201/9d88807e/attachment.html>


More information about the fpc-pascal mailing list