On 18.02.2013 19:53, DaWorm wrote:
On Mon, Feb 18, 2013 at 8:02 AM, Lukasz Sokol <el.es...@gmail.com
<mailto:el.es...@gmail.com>> wrote:


    Maybe he one and true answer for all of the above would be to have:

    try     vs              try
       try                   except
         try                 finally
         except              except
         end;                end;
       finally
       end;
    except
    end;

    so with except being optionally allowed either side of 'finally' ?

I haven't actually tried this, but what would this do?

try
   try
   except
   end;
finally
   try
   except
   end;
end;

If this is what is really desired, is this a good construct?

try
   ...
except
   ...
finally
   ...
except
   ...
end;


The idea for the construct is to replace (if I take your last example) the following construct:

=== example begin ===

try
  try
    try

    except

    end;
  finally

  end;
except

end;

=== example end ===

The variant

=== example begin ===

try

finally

except

end;

=== example end ===

would replace

=== example begin ===

try
  try

  finally

  end;
except

end;

=== example end ===

and

=== example begin ===

try

except

finally

end;

=== example end ===

would replace

=== example begin ===

try
  try

  except

  end;
finally

end;

=== example end ===

These are the most common usages of nested try...finally/except blocks and thus can increase the readability. Thus no change in semantics, only in "formatting".

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to