Rust wins again - D bites the Dust

Ownership and Borrowing in D
Nearly all non-trivial programs allocate and manage memory. Getting it right is becoming increasingly important, as programs get ever more complex and mistakes get ever more costly. The usual problems are:
The challenge is in keeping track of which pointers are responsible for freeing the memory (i.e. owning the memory), which pointers are merely referring to the memory, where they are, and which are active (in scope).
The common solutions are:

Solutions 2 and 3 more or less rely on faith in the programmer to do it right. Faith-based systems do not scale well, and memory management issues have proven to be very difficult to audit (so difficult that some coding standards prohibit use of memory allocation).

But there is a fourth way – Ownership and Borrowing. It’s memory efficient, as performant as manual management, and mechanically auditable. It has been recently popularized by the Rust programming language. It has its downsides, too, in the form of a reputation for having to rethink how one composes algorithms and data structures.

The downsides are manageable, and the rest of this article is an outline of how the ownership/borrowing (OB) system works, and how we propose to fit it into D. I had originally thought this would be impossible, but after spending a lot of time thinking about it I’ve found a way to fit it in, much like we’ve fit functional programming
into D (with transitive immutability and function purity).

dlang.org/blog/2019/07/15/ownership-and-borrowing-in-d/

Attached: d6.png (200x200, 5.03K)

Other urls found in this thread:

prev.rust-lang.org/en-US/friends.html
github.com/rust-lang/rfcs/blob/master/text/2000-const-generics.md
github.com/rust-lang/rust/pull/62435
danluu.com/deconstruct-files/
code.dlang.org/packages/sumtype
doc.rust-lang.org/book/ch18-03-pattern-syntax.html#destructuring-to-break-apart-values
twitter.com/NSFWRedditImage

Reminder that these languages are designed for retarded programmers and you're probably one of them if you advocate for these.

Reminder that everyone who says that is a LARPer.

It's an obvious choice, really. Overpay angsty white dudes who make rookie mistakes, or hire many competitively-paid professionals from the East who use quality languages.

...

...

oh yeah, Rust isn't stillborn. I heard the babe's cry myself. It cried out "Judith Butler", "Karl Marx", "Emma Goldman".
So 'stillborn' is the wrong term.
You might call it a post-birth abortion.
Or an act of eugenics.

everytime
prev.rust-lang.org/en-US/friends.html

Attached: smug office loli.png (2138x1449, 1012.43K)

pick one

...

The weeb is immunized against all dangers: one may call him a degenerate, pedophile, weirdo, autist, it all runs off him like water off a raincoat. But call him a weeb and you will be astonished at how he recoils, how injured he is, how he suddenly shrinks back: "I’ve been found out."

Ha ha! It's funny because it's not even a little bit true.

sudo apt remove chrome* *google* fonts-noto*

sudo apt remove javascript-common

sudo apt remove rust* libstd-rust* cargo*

sudo apt remove snapd* libsnapd*

...

Halfassing at its finest.

guix package -i brain
Ok, but really you're right about a few things:
Google is cancer, but sane distros use ungoogled chromium.
Snap packages are centralized crap, SaaSS owned by Canonical and their repo (the only one you can use actually) contains nonfree software.
It shouldn't be used for desktop stuff, but it is not malicious by design.
I don't like the syntax or all the hype around it, but it doesn't seem malicious. It even fixes some problems C has and weenies think of as features.
sudo apt purge apt
Install Guix, because APT is shit.

based

You sound jealous, goon.

You sound degenerate, weeb.

doesnt matter, replace whats in use by and large (like C++ or Python) by actually being more useful and powerful without being complicated piece of shit, thanks

Wait, you mean that shoehorning C++11's syntax into a language that forces a type driven design pattern while adding idiosyncratic changes that have no benefit and act as a footgun for people coming from a different language WASN'T a great idea?

8frens, on the reals, should I abandon Rust and learn D?

D's a lot of fun. The only complaints I saw on the forum were from being trying to use brand new features (like this one) and getting jerked around a bit as the language evolved.
The big downside to D from the perspective of someone looking at Rust is that D is garbage-collected and the no-GC option isn't a first-class alternative. If you start with -betterC from the beginning you can avoid GC, but this is a very different (though still very good--better than C, like it says on the tin) experience.

filter and global report all rust shill threads

this. and

Who let >>>/reddit/ in?

Probably yes, they didn't invented everything themselves.
The same question. D seems to be what C++ should be - it has so consistent syntax.

LARPer spotted


kys


weeb spotted

LARPer spotted. Syntax is one of the most important things in ANY language if you think differently, go and use brainfuck and show us syntax doesn't matter.

LARPer spotted
But brainfucks syntax is fine.

Better, if you think syntax is not important at all, use plain binary code - it (AFAIK) doesn't have any syntax. Go ahead, syntax is for LARPers!
So write an OS in it or a browser or a reimplementation of grep, find, etc. In languages with normal syntax it is easier task. Can you code in LISP? Its syntax is great.

Why are you trying to normalize pedophilia? I wonder (((Who))) has entered this thread?


yes it does if it's especially bad like in Rust

Attached: JIDF_enters_the_thread.webm (854x480, 4.76M)

This is what you sound like.
Stop LARPing.


Good argument, weeb.

Funny as fuck.
More like

Funny as fuck.
More like

You are just constantly repeating same thing. Also, why are you ignoring points? You aren't a paid shill, are you?

Attached: paid_shill.webm (1280x720, 2.83M)

You are just constantly repeating same thing. Also, why are you ignoring points? You aren't an unpaid anti Rust shill, are you?

What a shame. You aren't very creative. Why don't you post something useful to prove you actually know something. Post some Rust code. But you are just an amateur shill, aren't you? Or is Rust so bad programming language that there simply aren't any programs written in it?

Attached: Fuhrer.png (174x162, 19.57K)

what's the best Rust tutorial that isn't written or related in any way to the commie?
Looking for tech writing, non-Rust inspiration.

Doesn't exist. Prove me wrong.

...

fib(N) = R :- ( N < 2 -> R = N; R = fib(N - 1) + fib(N - 2) ).>he doesn't know a logical language

Just a reminder that Borrow checking and Automatic Garbage Collection are crutches designed to aid brainlets in programming.

Attached: 1562179018427.gif (498x278, 1.69M)

You aren't on /g/, obvious board tourist. Lurk more or back to cuckchan.

I don't have to prove anything to a LARPer.


nice brain damage

This is why D is shit. It has to have every feature and programming model under the sun, it's no wonder nobody fucking bothers to learn all that shit.

Attached: D.jpeg (540x535, 85.24K)

have you heard of a language called C++?

C++ only started doing that that after it already had decent adoption. If it didn't have adoption, nobody would bother with it.

Are you sure? I don't think there is anything quite as complicated as C++ except maybe APL.


So if you wrote down a note to yourself about how to do something, you would actually first define a bunch of categories and explicitly define their capabilities? Or write an abstract syntax tree? Or do whateverthefuck Forth does?

Or would it be more like:
Open a file,
Read each line and do this
But don't do it if you see this other thing
Close the file. Done.

C-like syntax dominates because it's close to how we write, and that's how most of us learn to encode information (which is a broader category that programming falls into). You didn't take class notes with a bunch of method-chaining or arrows everywhere.

Which is why I get tired of all this multi-paradigm shit. Your language shouldn't do and be everything for everyone. Imperative is fine. OO is fine. FP is also fine. Doing all three just seems to lead to code bases diverging into various dialects that appear unpredictably in code bases.

Go sucks in a lot of ways, but I've never had the problem of not understanding the source of a library I use. I rarely look at C, but it's usually not that confusing. Python, however takes too much from different styles. Python could look like Java or C or Scala (or all three) depending on who wrote it. Then I look at Rust code, and I'm wading through type definitions to find the logic I actually care about only to see some macro shit that I have to look up in another crate's docs.

Just glance over this shit.
HTTPS://docs.Rust-lang.org/STD/vec/struct.vec.html

There are about 100 explicit trait implementations. 66 of them are for partial equality for arrays size 0-32 borrowed and then owned (I guess you're out of luck if you have an array of length 33). In the source for this craziness is a macro with a comment that less important trait methods were left out to reduce "code bloat". Really.

Forth is a wordcode interperter that mostly does stack operations.

...

Spotted the braindead cnile.
Ok. You can stop LARPing now.
This is being worked on.
github.com/rust-lang/rfcs/blob/master/text/2000-const-generics.md
github.com/rust-lang/rust/pull/62435
No. You just have to manually coerce the array to a slice.

would much rather use a language that's reasonably designed, thanks.

You can't add something to an array. An array in Rust is of fixed size. The length is part of the type signature.
You would have to create an array of length 33, copy the the old stuff over and then put the new element in.

this person calls people 'cnile'.
YOU ADD SOMETHING TO AN ARRAY BY EDITING THE SOURCE CODE BECAUSE YOUR PROGRAM NOW NEED +1 ELEMENTS
CODE IS NOT SOMETHING YOU FRAME AND PUT ON A WALL
CODE GETS EDITED AND CHANGES OVER TIME

...

C borrowed from Algol. It's not good because it's C, it's good because it reads like most people think, unlike Lisps, for example. Rust is also a C-like, Mr. Valedictorian from University of Mumbai. Rust just also allows you to write a hideous mish-mash of functional and imperative style with macros and Java decorators (Oops, I mean proc-macros) sprinkled everywhere.
Now that's sophistication!
Always tomorrow, it seems.


Do other languages require explicit implementation of how to do an elementary operation like "are these the same?" The point is, there is an outrageous amount of really basic shit Rust forces you to explicitly define the behavior of. You can't even represent a struct without applying the Derive(debug) decorator. When do you NOT want that ability? Does duck-typing really cause that many mission critical errors? Because you're spending a lot of time telling the rust compiler, "yes, rust, you can show this in an error message" or "yes, rust, you can compare these things of the same type." Sensible, opinionated defaults are really refreshing sometime.


Larry Wall, in his infinite love for NEETkind, sent his only begotten daughter Camelia to die for our sins. Take not her name in vain. Accept her into your heart and be saved from your floating point arithmetic sins.

Rust has a dynamically sized array. It is called Vec.


Yes
?
When you don't want to accidentally expose stuff, like for example passwords.
Yes
Btw you're an actual fucking retard. Go to university or pick up a few books.

You constantly complain about LARPing but you never post code or contribute anything of substance.

Found the newfag. I posted a lot of code on Zig Forums.
Also what code should I post?
Does anyone on Zig Forums contribute anything of substance? You sure as hell aren't.

Are you fucking serious? If you're developing the program, then you need to hide program internals from yourself? Better blindfold myself before I open up my editor! Why is your sensitive user input getting passed around in the clear in the first place? Do you not realize your structs are private by default? This contrivance is hysterical, irrational paranoia. Rust shills are so emotionally unstable they'll throw out the most nonsensical defenses. The accusations of C++'s unsafety floating around in Rust's fluff-pieces on Medium are grossly exaggerated and ignore every post C++11 feature. Never mind the fact that most modern languages are memory safe to begin with. But, yeah, let's kill any sane default behavior because what-if-I'm-retarded?

D, why couldn't you be the language big tech decided to shill?


Some of us do have jobs.

Yes
Programmers fuck up something as simple as don't free the same pointer twice. Why wouldn't they fuck up accidentally outputting secrets?
You're so fucking retarded. If you derive Debug your structs aren't private anymore because you can inspect the Debug output.
Which of those don't use a GC?
What does that have to do with what I wrote though?

This is a Redditor meme. Most business problems are being solved with garbage collected languages. What is this board written in? If you can do HFT at Jane Street in OCaml, the GC is not your problem.

I also don't know why you think that hiding debugging info from yourself is a feature or even prevents the programming error you described, but I wish you luck in your comp sci 102 class this fall.

Most software is also complete fucking garbage, especially whatever heap of shit Zig Forums runs on.

Who are you quoting?
But that's the whole point of Rust.
Also no debugging info is hidden. gdb doesnt give a shit if your type implements Debug or not.
I never had this class. I didn't go to a burger university.

With a nuanced opinion like that, you must be really smart. I bet you get paid a lot for your quality software.


University of Mumbai student detected

More like one of the top German universities.
Protip: Everything does suck. Most software is a badly designed patchwork of braindamage. Just take a look at this: danluu.com/deconstruct-files/

People much smarter than both of us combined are saying that most modern software is complete shit.

programming languages are bloat

>danluu.com/deconstruct-files/
PostgreSQL developers are based and braindamagepilled.

that text makes everything storage related look really bad

Are you that idiot who made a thread to suck your own dick over some toy event loop you wrote in C++ as part of your "environmentally friendly" blockchain vaporware bullshit? How about you confine your bullshit to your ivory tower where you continue to solve no useful problems whatsoever.

Opinion discarded.

This is now a thread about dogs. See pic related.

Attached: 2iamidblhde21.png (720x960, 977.42K)

brainlet detected

No. I don't write C++. I'm the genius that posted the Rust code in that thread.

Gr8 b8 m8, 8/8

Absolute state of Rustrannies.
P.S. - you will never be a real woman

What about pattern matching? D doesn't have that.
Obviously. I'm a man.
P.S. - you will never be not a LARPer

You're obsessed with calling others LARPers because you're LARPing as a programmer using Rust.

But I am a programmer using Rust.
unbased btw

D is powerful enough to implement sum types with pattern matching as a library.
code.dlang.org/packages/sumtype

Pretty cool. But the pattern matching is very limited.
doc.rust-lang.org/book/ch18-03-pattern-syntax.html#destructuring-to-break-apart-values

Reddit isn't sending their best.

wrong