home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,312 of 243,242   
   David Brown to bart   
   Re: _BitInt(N)   
   02 Dec 25 13:45:57   
   
   From: david.brown@hesbynett.no   
      
   On 02/12/2025 13:21, bart wrote:   
   > On 02/12/2025 07:31, David Brown wrote:   
   >> On 01/12/2025 23:59, Janis Papanagnou wrote:   
   >>> On 2025-12-01 21:06:13, Keith Thompson wrote:   
   >>>>   
   >>>> The use of curly braces vs. begin/end is IMHO trivial.  [...]   
   >>>>   
   >>>> Someone who dislikes C for whatever reasons will probably dislike   
   >>>> most other languages that use curly braces, and not necessarily   
   >>>> because of that one syntactic detail.   
   >>>   
   >>> There may also be just simple practical real-life facts that   
   >>> influence the preferences of languages with curly braces (or   
   >>> brackets). I want to remind that keyboards from other domains   
   >>> may not have the simple access to the [ ] { } characters! On   
   >>> my US keyboard [ and ] are adjacent and directly accessible,   
   >>> and { and } are on the same keys reachable simply with 'Shift'.   
   >>> That's extremely convenient if you're programming C-like syntax!   
   >>> Though on my German keyboard these characters are placed on the   
   >>> top numbers row in one line, ordered as { [ ] }, and reachable   
   >>> only through the 'Alt Gr' key. This is really a pain to type.   
   >>> For _very common characters_ in a fairly common and rich family   
   >>> of programming languages it's an issue [in such non-US domains].   
   >>>   
   >>   
   >> My Norwegian keyboard needs AltGr for {[]}, but I don't find it a   
   >> burden - it's habit, I suppose.   
   >>   
   >> But in days gone by if anyone ever needed to use trigraphs for C   
   >> programming, then I am sure they would happily switch to a word-based   
   >> language given half a chance.  I find "{ }" nicer than "begin end",   
   >> but I'd pick "begin end" over "??< ??>" any day!   
   >>   
   >   
   > So:   
   >   
   >    if .. then begin ... end else begin ... end   
   >   
   > ... represents multiple statements.   
   >   
   > Even I would see braces in a more favourable light. I wonder why it took   
   > some years for language designers to realise you could simply have:   
   >   
   >    if .. then ... else ... end   
      
   I think different languages handle it differently.  Some might do it the   
   way you suggest with "if ... then ... end", others with the full "if ...   
   then begin ... end", others with "if ... begin".   And some have "if ...   
   fi", or "if ... end if".  I haven't looked in detail - there are many   
   languages, and many possibilities.  It will depend on whether the block   
   part is considered part of the conditional statement, or whether the   
   conditional only applies to a single logical statement which might be a   
   compound statement surrounded by block delimiters.   
      
   >   
   > Unfortunately that didn't really work for braces:   
   >   
   >    if (..) ... else ... }   
   >   
   >   
      
   Indeed - mismatched braces are not a good idea!   
      
   But if you make the braces a required part of the syntax, then you can   
   probably omit the parentheses :   
      
   	if ... { ... };   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca