[fpc-devel] Minor request with case else branches

J. Gareth Moreton gareth at moreton-family.com
Mon May 27 06:12:52 CEST 2019


I personally disagree with that one because it's just fluff, considering 
that "nothing" is equivalent to "{ nothing }" - usually a keyword or an 
intrinsic should actually do something.

Gareth aka. Kit

On 27/05/2019 02:33, Ben Grasset wrote:
> On Fri, May 24, 2019 at 5:46 PM J. Gareth Moreton 
> <gareth at moreton-family.com <mailto: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;
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190527/2f556082/attachment.html>


More information about the fpc-devel mailing list