Jump to page: 1 25  
Page
Thread overview
Why are you using D instead of Rust?
Oct 23
zjh
Oct 23
workman
Oct 23
jfondren
Oct 23
ag0aep6g
Oct 23
jfondren
Oct 23
ag0aep6g
Oct 23
russhy
Oct 26
bachmeier
Oct 25
Kagamin
Oct 25
user1234
Oct 25
Kagamin
Oct 25
user1234
Oct 25
Kagamin
Oct 23
Ben Jones
Re: Why are you using D instead of Rust
Oct 24
Antonio
Oct 24
Antonio
Oct 24
JN
Oct 26
bauss
Oct 29
harakim
Oct 29
zjh
Oct 29
harakim
Oct 29
deadalnix
Dec 16
IGotD-
October 23

Just would like to know you all opinions

October 23

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

>

Just would like to know you all opinions

I was using D long before Rust came along. It reeled me in from Java and C and I never looked back. It’s the only language I’ve used that I can honestly describe as fun. I have no reason to move to use Rust or any other language. I’m quite happy where I am.

And even if I were looking for something different, I don’t think Rust would be it. This may be superficial, but I just despise the syntax. That alone would be enough to keep me from even trying it without someone seriously persuading me otherwise.

October 23

On Saturday, 23 October 2021 at 04:39:14 UTC, Mike Parker wrote:

>

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

>

Just would like to know you all opinions

I was using D long before Rust came along. It reeled me in from Java and C and I never looked back. It’s the only language I’ve used that I can honestly describe as fun. I have no reason to move to use Rust or any other language. I’m quite happy where I am.

I'm very similar to you except I came from C#.

>

And even if I were looking for something different, I don’t think Rust would be it. This may be superficial, but I just despise the syntax. That alone would be enough to keep me from even trying it without someone seriously persuading me otherwise.

Same here, I just despise the syntax and couldn't get much used to it. I've tried to use more than once

October 23

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

>

Just would like to know you all opinions

Rust is just C++ with his hands tied.

October 23

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

>

Just would like to know you all opinions

Because I RUST is hard and D is more easy, I am stupid.

October 23

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

>

Just would like to know you all opinions

I wrote the following code and was very pleased with it until I thought of showing it to a coworker who didn't know Rust. At that moment I was struck by the very low ratio of "does what the application needs doing"/"does what Rust needs doing", and the feeling of pride turned to embarrassment. I didn't want to have to explain why all the 'extra' code was needed, or what it did.

#[link(name = "crypt")]
extern {
    fn crypt(key: *const c_char, salt: *const c_char) -> *c_char;
}

fn encrypts_to(key: &CString, salt: &CString, hash: &CString) -> bool {
    unsafe {
        let ret = crypt(key.as_ptr(), salt.as_ptr());
        if ret == std::ptr::null() { return false }
        hash.as_c_str() == CStr::from_ptr(ret)
    }
}

// ...

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_encrypts_to() {
        assert!(encrypts_to(
                &CString::new("password").unwrap(),
                &CString::new("$1$YzTLPnhJ$").unwrap(),
                &CString::new("$1$YzTLPnhJ$OZoHkjAYlIgCmOKQi.PXn.").unwrap(),
        ));
        assert!(encrypts_to(
                &CString::new("monkey").unwrap(),
                &CString::new("lh").unwrap(),
                &CString::new("lhBnWgIh1qed6").unwrap(),
        ));
    }
}

the d equivalent:

/+ dub.sdl:
    libs "crypt"
+/
extern (C) char* crypt(const(char)* key, const(char)* salt) @system;

bool encryptsTo(const(char)* key, const(char)* salt, const(char)* hash) @trusted {
    import std.string : fromStringz;

    return hash.fromStringz == crypt(key, salt).fromStringz;
}

unittest {
    assert(encryptsTo("password", "$1$YzTLPnhJ$", "$1$YzTLPnhJ$OZoHkjAYlIgCmOKQi.PXn."));
    assert(encryptsTo("monkey", "lh", "lhBnWgIh1qed6"));
    assert(encryptsTo("badsalt", "$$$", null));
}

This, long compile times, and losing sanity points over async/await servers is basically it for my objections to Rust at the time I gave d another look. Nowadays there would be more features that I'd miss from d, like better scripting, superior ctfe, generics, static reflection, and even code generation: Rust has a more syntax-abusive macro system but there's a lot of uses of it out there that are just "specialize this code over this list of types". And there's code like https://doc.rust-lang.org/stable/std/default/trait.Default.html#impl-Default-52

I think d/rust competition is pretty difficult atm. as d has a bunch of newbie hazards like betterC ("wow, this hello world is much faster! ... I can't use non-template functions from the standard library?") and ranges ("how do I get an array out of a MapResult?"), while Rust's relative noisiness as a language is balanced by the compiler's willingness to nearly write the noise for you with its error messages. Rust is mainly a lot readier in documentation to explain its WTFs, vs. d where something just seems odd (uncharitably: broken and misguided) for months until you run across a Steven Schveighoffer post about it.

But if you can get past the newbie experience, man, just look at the code.

October 23

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

>

Just would like to know you all opinions

Mainly because you're so unproductive with Rust. It takes so many more keystrokes and thinking to even get anywhere. And for what benefit? A marginally more safe code base? 🤔

I've written safety critical code for years. Rust isn't even proven in use yet.

Take a quick look at this:
https://www.cvedetails.com/vulnerability-list.php?vendor_id=19029&product_id=48677&version_id=0&page=1&hasexp=0&opdos=0&opec=0&opov=0&opcsrf=0&opgpriv=0&opsqli=0&opxss=0&opdirt=0&opmemc=0&ophttprs=0&opbyp=0&opfileinc=0&opginf=0&cvssscoremin=0&cvssscoremax=0&year=0&month=0&cweid=0&order=1&trc=19&sha=95e4d3703da65f4f319b5bfa6167ff26c6a83c13

And this:
https://github.com/rust-lang/rust/issues

Shouldn't those list be like... Shorter? 🤔

D has a balance of productivity and safety. We can improve D and get a nice language. But we need more people and/or focus to do that.

That's my opinion

October 23
On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code wrote:
> Just would like to know you all opinions

D has GC which is a proven success in the real world in getting stuff done.
October 23

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

>

Just would like to know you all opinions

Never had a reason to use it.

The syntax looks like a language designer's wet dream.

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.

Also, it's proggit's beloved darling which clearly means it's a hipster language... /s ;3

October 23
On 23.10.21 09:53, jfondren wrote:
> bool encryptsTo(const(char)* key, const(char)* salt, const(char)* hash) @trusted {
>      import std.string : fromStringz;
> 
>      return hash.fromStringz == crypt(key, salt).fromStringz;
> }

That function can't be @trusted. "Any function that traverses a C string passed as an argument can only be @system."

https://dlang.org/spec/function.html#safe-interfaces
« First   ‹ Prev
1 2 3 4 5