[fpc-devel] Re: [fpc-l] type discussion

Sebastian Kaliszewski sebaska at melkor.mimuw.edu.pl
Thu Jun 2 17:13:56 CEST 2005

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:


   mySth: local TSomething;

   mySth := TSomething.create();



   mySth: TSomething local;

   mySth := TSomething.create();



   mySth: TSomethin;

   mySth := TSomething.create();


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?

Sebastian Kaliszewski

More information about the fpc-devel mailing list