October 24, 2021

On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code wrote:

>

Just would like to know you all opinions

https://www.youtube.com/watch?v=75Ju0eM5T2c

October 24, 2021

On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code wrote:

>

Just would like to know you all opinions

Why did you pick Rust specifically?

I am not using either for anything that matters. Mostly because I haven't found a case where D or Rust provided a foundation to build on that others don't. Rust, as a language, is trying to solve a problem I usually don't have, at a significant modeling cost. Their approach might be worthwhile for larger executables built by larger teams.

Rust seems to have one major feature (tracking resource use). D is trying to provide all features and not really excelling at any particular domain. What prevents D from pursuing a multi paradigm approach is that it lacks a modular compiler implementation, so it has hit an evolutionary wall.

Rust has more of a cultural wall that will keep it true to its main focus, but that also prevents evolution. Rust and C++ attract programmers that accept complexity, as such, they are likely to become more complex over time. So programmers that feel those languages are difficult to learn are unlikely to be happy with where they are heading. Some might argue that D has comparable cultural challenges.

Right now it is difficult to say where D is heading. Seems to me that a restructuring of the compiler is needed, but there does not seem to be plan for it, so it is ulikely to happen.

October 24, 2021

On Sunday, 24 October 2021 at 01:57:21 UTC, Guillaume Piolat wrote:

>

On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code wrote:

>

Just would like to know you all opinions

https://www.youtube.com/watch?v=75Ju0eM5T2c

Word

October 24, 2021

On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code wrote:

>

Just would like to know you all opinions

Try to write this in Rust

T[] sorted(T)(T[] xs) {
  return  xs.length == 0 ? [] :
    xs[1..$].filter!(x=> x < xs[0]).array.sorted ~
    xs[0..1] ~
    xs[1..$].filter!(x=> x >= xs[0]).array.sorted;

void main() {
  [1,6,2,3,1,9,3].sorted.writeln;
}

D is not Scala... but it is more expressive than Rust (Thanks to UFCS, Ranges & GC).

October 24, 2021
On 10/24/21 1:57 PM, Antonio wrote:
> On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code wrote:
>> Just would like to know you all opinions
>
> Try to write this in Rust

Are you saying Rust makes it difficult to write inefficient algorithms? I have to learn more about Rust then. ;)

> ```d
> T[] sorted(T)(T[] xs) {
>    return  xs.length == 0 ? [] :
>      xs[1..$].filter!(x=> x < xs[0]).array.sorted ~
>      xs[0..1] ~
>      xs[1..$].filter!(x=> x >= xs[0]).array.sorted;
>
> void main() {
>    [1,6,2,3,1,9,3].sorted.writeln;
> }
> ```

I am glad we can do that but the number of arrays allocated there is *I think* 4 per sorted() call. Ouch!

And picking the first element as the pivot is known to hurt worst-case performance horribly. (For example, passing already (or nearly) sorted data will be very bad there.)

> D is not Scala... but it is more expressive than Rust (Thanks to UFCS,
> Ranges & GC).

D is not Haskell either so let's at least pick a random pivot. ;)

Ali
"Who possibly missed a joke."

October 24, 2021

On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code wrote:

>

Just would like to know you all opinions

I started with D before Rust existed. Also, I can't get around Rust syntax, I don't find it fun to look at. And in the projects I like to do, memory safety is not of utmost importance and the borrow checker gets in my way more than I'd like it to.

What I like about Rust however is how quickly their ecosystem is growing and how they have a good focus on features. Good focus on features means they have very good foundations in de-facto official things like HTTP libraries or serialization.

October 24, 2021
On Sunday, 24 October 2021 at 21:18:06 UTC, Ali Çehreli wrote:

> I am glad we can do that but the number of arrays allocated there is *I think* 4 per sorted() call. Ouch!
>
>
> D is not Haskell either so let's at least pick a random pivot. ;)
>
> Ali
> "Who possibly missed a joke."

Hi Ali,

This is only an example of expressiveness: no one in is right mind (I don't know if this is how it is said in english) will include this piece of code as a real sorting code.

But, and this is really interesting, the expression performs really well compared with other programming languages similar ones:  Python, Julia, Scala, Javascript, Crystal, Nim:  no one of them beats D.  https://github.com/ddcovery/expressive_sort

Javascript sorprised me a lot.  It is incredibly performant compared with Python, Julia, Scala... even Nim!!!:

I tried with Rust, but it was impossible to create an intelligible version.


May be an expression is useless but, at least, it is an expression :-).

October 24, 2021
On 10/24/21 3:45 PM, Antonio wrote:

> no one in is right mind (I
> don't know if this is how it is said in english) will include this piece
> of code as a real sorting code.

Cool! Making sure that no unsuspecting novice will take it as real sorting code... :)

Ali

October 25, 2021
On Monday, 25 October 2021 at 00:33:21 UTC, Ali Çehreli wrote:
> On 10/24/21 3:45 PM, Antonio wrote:
>
> > no one in is right mind (I
> > don't know if this is how it is said in english) will include
> this piece
> > of code as a real sorting code.
>
> Cool! Making sure that no unsuspecting novice will take it as real sorting code... :)
>
> Ali

Someone here in the forum pointed out this video ...

Quick sort in a strong pure functional language, with in-place mutation automatically done by the optimiser: really amazing stuff!

https://youtu.be/vzfy4EKwG_Y?t=1668
October 25, 2021

On Saturday, 23 October 2021 at 11:24:42 UTC, SealabJaster wrote:

>

I just don't see the point of using it for anything above systems programming, since a GC gives similar memory guarantees while being much easier to work with.

I do system programming with D. Ironically, system programming has trivial memory management, so rust doesn't really have much to show there, in fact it's bloated business applications like a browser where you might need a complex memory management system.