Modernised Pascal

From Free Pascal wiki
Revision as of 12:02, 17 December 2005 by Daniel-fpc (talk | contribs) (Proposal has been rejected)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

more strongly syntax

1)

if ... then

 ...

elsif {!}

 ...

else

 ...

end; {!}

2)

if 1 > a < 3 then ... {!} end

3)

 for i := 1 to 30 {+} step 5 {+.} do
 end {!}

4)

 while ... do ...
 end; {!}

5) alias for long name:

 when a = other_long_name1, b = other_long_name2 {!} do
   a.method1;
 end; {!}

6) block variables & initialization in declaration section:

  declare // ?
    var
      a: integer := DataSet1.Field[1].AsInteger;
    const
      b: integer = 1;
  begin
    ...
  end;

7) (?) property information 'access' abstraction ( on code compilation phase ):

  TClass1 = class
  ...
  published
    property FieldInt: Integer read fFieldInt write fFieldInt default 100;
  end;
  constructor TClass1.Create(...   
  begin
    inherited;
    fFieldInt := TClass1.FieldInt.DefaultValue; {!} // for non object types
  end;
  procedure TClass1.Check(...
  begin
    if fFieldInt = TClass1.FieldInt.DefaultValue then
       ...
    end


  1. Rejected. A proposal like this show exactly why begin/end is elegant, you don't need elseif.
  2. Rejected. Only purpose is to save some typing.
  3. "step" proposal not rejected (but not accepted as well), removal of "begin" rejected
  4. Rejected ... for removal of "begin"
  5. Rejected; aliases makes code harder to read.
  6. Don't understand what you want here.
  7. const field_default=100 does the same. Rejected.

Daniel-fpc 11:02, 17 Dec 2005 (CET)