Thread overview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
March 16, 2013 Rust vs Dlang | ||||
---|---|---|---|---|
| ||||
Hi folks! I had wrote small article about Rust vs D. I hope that you will like it! http://versusit.org/rust-vs-d |
March 16, 2013 Re: Rust vs Dlang | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On 3/16/13, Suliman <evermind@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.
This:
```
void main() {
foreach (i, val; taskPool.parallel(new int[10]))
{
writeln("Hello:", i);
}
}
```
Also very very wrong, you don't have to allocate, use iota:
void main()
{
foreach (i, val; taskPool.parallel((iota(0, 10)))
{
writeln("Hello:", i);
}
}
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.
Anyway I don't agree with the conclusions, this is barely scratching the surface of either language.
|
March 16, 2013 Re: Rust vs Dlang | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | Andrej Mitrovic, thanks! I will fix it! yes look like bbcode put some crap in page body. We will try to fix it. |
March 17, 2013 Re: Rust vs Dlang | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On 3/16/13 10:42 AM, Suliman 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
Nice writeup. Could you please fix the code formatting? Indentation is lost at least on Chrome and Firefox on OSX. Then I'll be glad to post on reddit.
Andrei
|
March 17, 2013 Re: Rust vs Dlang | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Saturday, 16 March 2013 at 14:42:58 UTC, Suliman 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
I agree, only Rust seems to compete with D for the goal as being a real alternative to C/C++. Interesting read comparing the two.
If I may critique, the section concerning error handling, the comparison is not accurate. The D equivalent of what was shown in Rust needs to show how try-catch-finally, or scope(...), is used to perform the equivalent error handling.
--rt
|
March 17, 2013 Re: Rust vs Dlang | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| On Sat, 2013-03-16 at 21:06 -0400, Andrei Alexandrescu wrote: > On 3/16/13 10:42 AM, Suliman 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 > > Nice writeup. Could you please fix the code formatting? Indentation is lost at least on Chrome and Firefox on OSX. Then I'll be glad to post on reddit. Comments such as "There are no threads in D out of the box, but they can be implemented with the use of language libraries" seems unfair all round. The D platform is compiler + Phobos so there are threads out of the box. D also has spawn just as Rust does; out of the box. Also all the imports for D are missing from the code. The error handling example is unfair to D, it is not like Go where return codes are the sole mechanism of error handling, D has exceptions analogous to Rust. The switch example maximizes the number of write operations which is minimizing the "functional approach" that the article appears to be driving at. So does the switch statement return a value in either language? If not can maps/dictionaries be used so as to have a single output statement of a selected string? -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
March 17, 2013 Re: Rust vs Dlang | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| On Sat, 2013-03-16 at 21:06 -0400, Andrei Alexandrescu wrote: > On 3/16/13 10:42 AM, Suliman 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 > > Nice writeup. Could you please fix the code formatting? Indentation is lost at least on Chrome and Firefox on OSX. Then I'll be glad to post on reddit. Sorry I forgot to add: Can either of the codes calculate: factorial(40) ? i.e. are the codes at all relevant given that 32-bit and 64-bit integers are useless for this calculation? Python happily and correctly calculates factorial(2000). Also if a functional approach is being advertised why use an imperative algorithm for factorial, with it's explicit iteration, why not use reduce so as to hide the itertation. In D: reduce!"a * b"(1L, iota(1, n+1)( It appears the 1L is needed here when using ulongs or type inference fails :-( -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
March 17, 2013 Re: Rust vs Dlang | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob T | On 17.03.2013 07:25, Rob T wrote:
> On Saturday, 16 March 2013 at 14:42:58 UTC, Suliman 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
>
> I agree, only Rust seems to compete with D for the goal as being a real
> alternative to C/C++. Interesting read comparing the two.
>
At least on Windows, C# would be an alternative the minute that Microsoft decides to offer a direct native code compiler instead of the AOT + JIT combo.
They have done it for Singularity and part of that work is now being used in Windows Phone 8, where .NET applications are actually compiled to native code when uploaded to the Windows Store.
Go could be an alternative, given the proofs given by Oberon and Active Oberon as system programming languages, which Go kind of follows.
However the Go guys just don't agree with the progresses made in language abstractions in the last decades, which in my view is a plus point for D and Rust, and made me stop caring about Go.
In Europe Ada seems to be picking up some users now that there is a good quality free compiler available (GNAT) and the public is more aware of the security issues created by C and C++ when used by junior developers.
Anyway the more languages the better.
--
Paulo
|
March 17, 2013 Re: Go vs. D [was Re: Rust vs Dlang] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto Attachments:
| On Sun, 2013-03-17 at 08:59 +0100, Paulo Pinto wrote: […] > However the Go guys just don't agree with the progresses made in language abstractions in the last decades, which in my view is a plus point for D and Rust, and made me stop caring about Go. […] So what are the features that Go is ignoring that D has? An article on this would be good marketing for D just now. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
March 17, 2013 Re: Go vs. D [was Re: Rust vs Dlang] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On 17.03.2013 09:05, Russel Winder wrote: > On Sun, 2013-03-17 at 08:59 +0100, Paulo Pinto wrote: > […] >> However the Go guys just don't agree with the progresses made in >> language abstractions in the last decades, which in my view is a plus >> point for D and Rust, and made me stop caring about Go. > […] > > So what are the features that Go is ignoring that D has? > > An article on this would be good marketing for D just now. > The first known one is that Go is the only strong typed language to eschew generics in the 21st century. For the rest, copying from my discussion on Lambda the Ultimate about C++ developers not jumping into Go (http://lambda-the-ultimate.org/node/4554#comment-71504): - exceptions; - enumerations; - generic types; - direct use of OS APIs, without the need of writing wrappers; - currently only static compilation is available; - due to static compilation only model, there are issues with 3rd party code; - no support for meta-programming; - rich set of available libraries; - the PR about go routines and channels, usually forgets to mention that similar features do exist as libraries for other languages I know you can fake enumerations with typed consts, but it is not the same thing as real enumerations. My point about direct OS APIs is that while D and Rust follow the approach used by other languages where you just declare bindings, Go forces the use of the CGO tool and a C compiler that speaks Go ABI. Their talk about fast compilation is also quite effective with young developers that did not grew up with Modula-2 and Mac/Turbo Pascal or using other compiled languages with modules, so they think Go is the first compiled language to offer that. Feel free to destroy. :) -- Paulo |
Copyright © 1999-2021 by the D Language Foundation