Related articles |
---|
[7 earlier articles] |
Re: My scripting language - any suggestions? mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-08-31) |
Re: My scripting language - any suggestions? licaner@gmail.com (lican) (2008-08-31) |
Re: My scripting language - any suggestions? mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-09-01) |
Re: My scripting language - any suggestions? ademakov@gmail.com (Aleksey Demakov) (2008-09-02) |
Re: My scripting language - any suggestions? mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-09-02) |
Re: My scripting language - any suggestions? licaner@gmail.com (lican) (2008-09-04) |
Re: My scripting language - any suggestions? jaluber@gmail.com (Johannes) (2008-09-06) |
Re: My scripting language - any suggestions? ademakov@gmail.com (Aleksey Demakov) (2008-09-07) |
Re: My scripting language - any suggestions? bobduff@shell01.TheWorld.com (Robert A Duff) (2008-09-07) |
Re: My scripting language - any suggestions? mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-09-08) |
Re: My scripting language - any suggestions? felipeangriman@gmail.com (Felipe Angriman) (2008-09-08) |
Re: My scripting language - any suggestions? sammyderoy@sympatico.ca (Sammy) (2008-09-10) |
From: | Johannes <jaluber@gmail.com> |
Newsgroups: | comp.compilers |
Date: | Sat, 6 Sep 2008 03:43:11 -0700 (PDT) |
Organization: | Compilers Central |
References: | 08-08-069 08-08-081 08-08-100 08-08-106 08-08-107 08-08-109 08-09-006 08-09-014 08-09-021 |
Keywords: | types, design |
Posted-Date: | 07 Sep 2008 17:31:15 EDT |
On Sep 4, 1:59 pm, lican <lica...@gmail.com> 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.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.