[fpc-devel] Minor request with case else branches

Ben Grasset operator97 at gmail.com
Mon May 27 03:33:32 CEST 2019


On Fri, May 24, 2019 at 5:46 PM J. Gareth Moreton <gareth at moreton-family.com>
wrote:

> Whenever I come across a section of code in my own projects where "*else *
> ;" is necessary, or any empty branch for that matter, I put a "{ Do
> nothing }" comment just to make it absolutely clear that the block is
> there deliberately and so there isn't any confusion with the syntax on
> first viewing; e.g:
>

On a more general scale, it seems like it might be a reasonable spot for an
actual new case-block-specific keyword? I can't imagine it would be an
insurmountable task to do something like make the literal word "nothing"
(followed by a semicolon) act as "sugar" in the context of case blocks for
what a lone semicolon normally does.

For example:

type TSomeEnum = (A, B, C, D);

case BlahBlah() of
  A: DoThingForA();
  B: DoThingForB();
  C: nothing;
  D: DoThingForD();
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190526/e582931b/attachment.html>


More information about the fpc-devel mailing list