[fpc-pascal] The reason why linus torvalds hate-pascal

Zaher Dirkey parmaja at gmail.com
Sun Apr 20 01:24:00 CEST 2008


I hate exit when i try to improve a procedure

 some code
if (b) then
exit;
 some code

for long procedures i cant notice exit here and add some resource or memory uses

AnObject := TAnObject.Create;
try

 some code

 if (b) then
   exit;

 some code

finally
  AnObject.Free;
end;

Now Exit leave the procedure without freeing "AnObject".
We need a new Exit keyword to jump to Finally section (I do not think
Abort is useful here).

On Fri, Apr 18, 2008 at 7:58 PM, Ricardo Aguiar <neldor at aclnet.com.br> wrote:
>
>  Hi!
>
>  GCC and almost all the other C implementations have the goto
>  statement. It is just ugly and dangerous use it many times in a
>  program. But IMHO any compiled language should have goto
>  because many times we need to do unstructured code to run
>  fast (in complex search code for example).  So goto is not a
>  matter of principles about the language, it is just a "dirty and
>  ugly" approach to solve problems that many times are useful.
>
>  Anyway in my oppinion a very complex program in a structured
>  language with more than a dozen gotos should not be considered
>  a good pratice (except for kernel internals and things like this -- that
>  many times would be a lot more complex without the gotos).
>
>  Ric.
>
>
>
>  On Thursday 17 April 2008, Marco Alvarado wrote:
>  > The problem of GOTO is that C doesn't have one. If C had one, and
>  > Pascal didn't have a GOTO, they would blame Pascal for not having it.
>  > In assembler GOTOs make a lot of sense (i.e. JMP and Jxx), and it's
>  > weird C doesn't have one, after all C tries to be the lowest level of
>  > the highest level languages. It's great Pascal have both high and low
>  > level features.
>  >
>
>
> _______________________________________________
>  fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>  http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Zaher Dirkey



More information about the fpc-pascal mailing list