Difference between revisions of "Talk:Modernised Pascal"

From Lazarus wiki
Jump to navigationJump to search
(my idea's of proposals)
 
(braindump)
Line 18: Line 18:
 
.........
 
.........
 
i tried to giggle here, but later decided to go main page :)
 
i tried to giggle here, but later decided to go main page :)
 +
 +
== braindump ==
 +
 +
- "Abstract class" declaration like Java?
 +
 +
- "Removal of begin"? Nice :) The only interesting thing in VB (of course done badly :-/ ) is having a different block terminator for each block "type". I guess it would be nice to have these and implicit blocks in all conditionals.
 +
 +
- Non-reusable variables. Most of the time you don't need and you don't want to assign unrelated values to a variable repeatedly (i.e. you only need to use ':=' once on it). To be allowed to reassign a variable it should have to be declared with a special directive.

Revision as of 12:58, 12 March 2006

4) - that might make sense, if also applied to for, with, if, making 'begin' implicit everywhere, like it is done in Component Pascal. However it is major leap, and can be considered only in terms of implementin one more specific non-Borland mode. But personall i'd prefer implicit 'try' there :)

6) - as far as i got it, it is runtime variable initialisation, instead of compile-time one. Syntactic sugar of doubtful quality. I would say that may make sense together with 5), modifiyng with to make shortcuts to some subclasses, record members, whatever.

 with Addr = DataSet1.FieldByName['Address'], Phone=DataSet1.Field['Telephone'].AsInteger do 
      begin
           Addr.Value := Addr.Value + #13#10 + IntToStr(Phone)
      end;

Hence, turning with into bi-modal operator, like FROM clause in SQL SELECT, ehich can settle default table without alias and other tables with aliases.

However this a major change in compiler, and cons and pros are not clear. - '=' looks absoletely not Pascal-style here, replaccing it with 'is' is even worse, brand new keyword like "beeing" ? Pascal is to be small language, even is not as small as Component Pascal :) - Compiler would have hard time to decide what to stor in aliases: cached value read-only, pointer to original variable, pointer to some object returned by some function, make inline substitution or whatever. + Programmer is no more needed to settle teporary variables, and would never change or Dispose it by mistake. + Programmer have easy way to avoid multiple expensive functions calls, like .FieldByName is. However it would be not making new initialized variables, but rather an aliases to exisiting ones.

......... i tried to giggle here, but later decided to go main page :)

braindump

- "Abstract class" declaration like Java?

- "Removal of begin"? Nice :) The only interesting thing in VB (of course done badly :-/ ) is having a different block terminator for each block "type". I guess it would be nice to have these and implicit blocks in all conditionals.

- Non-reusable variables. Most of the time you don't need and you don't want to assign unrelated values to a variable repeatedly (i.e. you only need to use ':=' once on it). To be allowed to reassign a variable it should have to be declared with a special directive.