[Issue 10862] Assignment inside if condition still sometimes accepted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 20 17:21:32 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10862



--- Comment #8 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-20 17:21:26 PDT ---
(In reply to comment #7)
> > Rightit'snotlikespacescontributetoreadabilityoranything.
> 
> There's a huge difference between not inserting a space between elements which
> are already separated by other grammar elements and not putting spaces between
> words.

W.r.t. "if(" vs. "if (", it's not a big deal. However I have to argue about
your statement.

Someone was talking about the Fox toolkit recently, how it might be a good idea
to port it to D. But then I had a look at it's codebase. Here's a glimpse of
the code:

----- 
if(XGetSelectionOwner((Display*)getApp()->getDisplay(),getApp()->xdndSelection)!=xid){
      fxwarning("%s::beginDrag: failed to acquire DND
selection.\n",getClassName());
      return false;
      }
    resizeElms(getApp()->xdndTypeList,numtypes);
    memcpy(getApp()->xdndTypeList,types,sizeof(FXDragType)*numtypes);
    getApp()->xdndNumTypes=numtypes;
   
XChangeProperty((Display*)getApp()->getDisplay(),xid,getApp()->xdndTypes,XA_ATOM,32,PropModeReplace,(unsigned
char*)getApp()->xdndTypeList,getApp()->xdndNumTypes);
   
XChangeProperty((Display*)getApp()->getDisplay(),xid,getApp()->xdndActions,XA_ATOM,32,PropModeReplace,(unsigned
char*)getApp()->xdndActionList,6);
-----

Some of those lines span over 160 characters. I can barely see which argument
becomes which parameter in these function calls, and everything is mushed
together. There's a maximum effort of saving whitespace, as if having all
characters on the screen is somehow going to enable someone to automatically
process more information. 

We're not machines that parse grammars. Grammar rules or not, we need some
breaks and some whitespace to be able to read and comprehend.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list