[fpc-pascal] Syntax changes suggestions

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Thu Jul 19 10:54:31 CEST 2018


On 18/07/18 20:45, Ryan Joseph wrote:
>> On Jul 18, 2018, at 1:46 PM, R0b0t1 <r030t1 at gmail.com> wrote:> > You can make the function yourself. That you may have problems with> typing are indicative that the language could use a more expressive> type system, not that it was a good idea to create an intrinsic that> could (potentially) ignore types.
> I don’t remember what it did exactly. Like this maybe?
> n = (x != 0) ? 10 : 20;
> if x <> 0 then  n := 10else  n := 20;
> n := IfThen(x <> 0, 10, 20);
> People are probably sick of doing that and wanted a more concise statement. I’ve even seen people do stuff like this because they’re fighting the language.
> if x <> 0 then n := 10 else n := 20;
> They probably wanted something like this:
> n := if x <> 0 then 10 else 20;
> Not too crazy in my opinion.

Without wanting to reopen the debate or appear to be criticising the 
developers, ALGOL-60 did this:

FOR I := 1 STEP 6 UNTIL M DO
BEGIN  PCHTX(SYTB[I], WRITEBUFFER[0],
         IF M-I > 6 THEN 6 ELSE M-I+1);
     WRITE (PCH,10,WRITEBUFFER[*]);
     CLEAR(WRITEBUFFER[0],9)
END;

I make no apology for the layout, since that's a fragment of Wirth's own 
code.

-- 
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-pascal mailing list