home bbs files messages ]

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

   comp.os.linux.misc      Linux-specific topics not covered by oth      135,536 messages   

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

   Message 135,258 of 135,536   
   John Ames to ldo@nz.invalid   
   Re: C/C++ timeline (was Re: Python: A Li   
   06 Feb 26 13:55:13   
   
   From: commodorejohn@gmail.com   
      
   On Fri, 6 Feb 2026 20:59:44 -0000 (UTC)   
   Lawrence D’Oliveiro  wrote:   
      
   > > ... [Java’s] classes *aren't* namespaces, so there's no class   
   > > equivalent for using in C++ - so you can't just call   
   > > helperFunction(someObject), you have to write   
   > > utilityClass.helperFunction(someObject) instead.     
   >    
   >    
      
   I forget that - but it only partially mitigates the problem. You can   
   get System.out.println() down to out.println() f'rexample, but AFAICT   
   you still have to package functions into a container class and call   
   them as methods of that class; you can't just write println("a string")   
   like you can in any decent, humane language.   
      
   That's conceptually confusing on top of being annoying; class methods   
   should represent operations on objects of that class, but since there's   
   no way to create generalized functions not attached to a class, you end   
   up with classes that serve no purpose other than to aggregate random   
   utility functions.   
      
   (In the best case, they might at least be organized - java.lang.Math   
   f'rexample has the decency to contain only math-y sorts of entities -   
   but anyone having a passing familiarity with human nature will know how   
   often that's actually the case in the Real World.)   
      
   But nobody declares a Math object any time they need a number variable   
   to "do math at" at some point in their program; they have objects of   
   specific number-type classes for that. So instead of doing things   
   sensibly:   
      
       Integer anInteger;   
       Double aDouble = 1.5;   
       anInteger = aDouble.round();   
      
   ...you have to bring some other miscellaneous class into view:   
      
       Integer anInteger;   
       Double aDouble = 1.5;   
       anInteger = Math.round(aDouble);   
      
   ...except when, for some reason, you don't:   
      
       Integer a = 2, b = 3;   
       Integer c = b.max(a, b);   
      
   ...except that this is not properly a method of the *object,* but a   
   static method of the *class,* so:   
      
       Integer a = 2, b = 3;   
       Integer c = b.max(a, c);   
      
   ...is valid even though b has nothing at all to do with matters.   
   Smalltalk got this right (math operations are methods of Number, and   
   other number types like Integer are subclasses of Number;) Java is just   
   arbitrary and confusing for no reason.   
      
   --- 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