Rust vs Dlang
Steven Schveighoffer
schveiguy at yahoo.com
Sun Mar 17 05:31:46 PDT 2013
On Sat, 16 Mar 2013 11:14:15 -0400, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> On 3/16/13, Suliman <evermind at live.ru> wrote:
>> Hi folks! I had wrote small article about Rust vs D. I hope that
>> you will like it!
>>
>> http://versusit.org/rust-vs-d
>>
>
> This code:
>
> ```
> In D a similar code would look as follows:
> void main() {
> for (int i = 0; i < 10; i++) {
> writeln("Hello");
> }
> }
> ```
>
> Should really be:
>
> ```
> foreach (i; 0 .. 10)
> writeln("Hello");
> ```
>
> It avoids the common mistake of using a signed 32-bit type for indexing.
That is not a mistake in this code. In fact, your replacement still uses
signed types.
> Also your example code seems to embed some strange hidden Unicode
> characters (Error: unsupported char 0xfeff) which make copy-pasting
> and running the examples not work.
feff is a BOM (byte order mark) which is typically at the beginning of a
file to establish the number of bits per code point and the byte order of
the code points. It is not strange, and it should be handled correctly by
dmd. If not, that is a bug.
-Steve
More information about the Digitalmars-d-announce
mailing list