From: clubley@remove_me.eisner.decus.org-Earth.UFP   
      
   On 2025-08-19, Dan Cross wrote:   
   > In article <68a493ec$0$710$14726298@news.sunsite.dk>,   
   > Arne Vajhøj wrote:   
   >>   
   >>Kotlin is rather picky about mixing signed and unsigned.   
   >>   
   >>var v: UInt = 16u   
   >>   
   >>v = v / 2   
   >>   
   >>gives an error.   
   >>   
   >>v = v / 2u   
   >>v = v / 2.toUInt()   
   >>   
   >>works.   
   >>   
   >>I consider that rather picky.   
      
   I've not used Kotlin, but I consider that to be the really good type   
   of picky. :-)   
      
   >   
   > It's kind of annoying that it can't infer to use unsigned for   
   > the '2' in the first example. Rust, for example, does do that   
   > inference which makes most arithmetic very natural.   
   >   
      
   I actually consider that to be a good thing. The programmer is forced   
   to think about what they have written and to change it to make those   
   intentions explicit in the code. I like this.   
      
   Simon.   
      
   --   
   Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP   
   Walking destinations on a map are further away than they appear.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|