[fpc-devel] new features and facilities
Mark Morgan Lloyd
markMLl.fpc-devel at telemetry.co.uk
Thu Oct 8 19:35:02 CEST 2015
David W Noon wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On Thu, 08 Oct 2015 16:12:56 +0000, Mark Morgan Lloyd
> (markMLl.fpc-devel at telemetry.co.uk) wrote about "Re: [fpc-devel] new
> features and facilities" (in <mv64m9$95v$1 at pye-srv-01.telemetry.co.uk>):
>> Ondrej Pokorny wrote:
>> As Michael has said, adding an extra else or for that matter
>> otherwise would be a problem.
>>> And what about the inline if? That should be backwards compatible
>>> at a first glance. And it would be a fun thing because the Delphi
>>> community has asked for it for many years and Embarcadero looks
>>> like they won't add it at all :)
>> Inline if is an ALGOL feature, and it's inexplicable why it's never
>> been in Pascal.
> Indeed, it is even more succinct in C/C++:
> x = <boolean> ? <then part> : <else part>;
At which point you'll have various members of the Pascal community
decrying it as too C-like.
> This was taken directly from ALGOL 60 and remains a very elegant feature.
> However, Jensen & Wirth excluded it from the original Pascal Report.
More to the point, I don't believe it was in in Wirth's early Pascal
compilers although it was in ALGOL-W. This is actually quite a messy
area, since ALGOL 68 changed the syntax to add an explicit FI for
compatibility with the statement-level IF THEN ELSE FI.
ALGOL also had inline CASE etc., and some implementations (e.g.
Burroughs) extended this to accomodate jump tables etc. Curiously,
Wirth's Stanford-era compilers use these liberally.
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-devel