home bbs files messages ]

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

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

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

   Message 1,436 of 2,753   
   Johannes to lican   
   Re: My scripting language - any suggesti   
   06 Sep 08 03:43:11   
   
   From: jaluber@gmail.com   
      
   On Sep 4, 1:59 pm, lican  wrote:   
   > a = 100.0   
   > s = "string text";   
   > d = s + a; // d == "string text100.0"   
      
   Personally, I'd prefer a different operator for string concatenations   
   (like D's "~"). That way you can prevent the following code from   
   misbehaving:   
      
   print("The round is: " + round + 1);   
      
   Instead of calculating round + 1 first, round is translated into a   
   string and 1 is translated into a string, which obviously gives wrong   
   results. Of course one can put parentheses around round + 1, but this   
   kind of bug is pretty much a newbie-trap and this can be avoided with:   
      
   print("The round is: " ~ round + 1);   
      
   Just make the priority of ~ low enough that it is called last before =   
   and everything should sort itself out.   
      
   --- 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