Michael Van Canneyt wrote:
This is only 'logical' if the hypothesis

"productivity is inversely related to the syntax verbosity"

is correct.

And it's not.

What is correct is "productivity is directly related to the number of separate language constructs developer has to put in program to acomplish the task"


So, for example, need to put separate finally block to free memory means additional few constructs. Or lack of standard libary supplied container apropriate for a task requires programmer to develop his/her own or to adapt something less usable.

Geeintg rid of end in begin / end wont help much (as they can;t be separated, they count as single construct).


So here is some little idea which seems to me Pascalish enough to be considered:

how about new keyword: local
Class variable declared local will be automatically freed upon every exit from the scope (i.e. something along the lines of implicit try/finally for some builtin types).


And there are possibly few variants of the thing:

1a.

var
  mySth: local TSomething;

begin
  mySth := TSomething.create();
  ...

end;


1b.

var
  mySth: TSomething local;

begin
  mySth := TSomething.create();
  ...

end;


2.

local
  mySth: TSomethin;

begin
  mySth := TSomething.create();
  ...

end;



So in 1. local is just a type modifier (in case of 1a it might make sense to allow it also in type declaration, hence allowing allways local classes -- but I'm not convinced it's desirable, and it definiately requires more work on compiler side). 1b. is like some other storage modifiers like absolute (and might be prefered). 2. is substituting local instead of var for local objects -- so such local object declarations stand out more int the code, but it's also further away from standard Pascal.


Is it worth something?


rgds
--
Sebastian Kaliszewski

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to