[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/Rust General/ - Honey, I'm Home Edition
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 46
Thread images: 4
File: 53498.jpg (35 KB, 1680x1260) Image search: [Google]
53498.jpg
35 KB, 1680x1260
ITT /Haskell done right general/
>>
kill yourself
>>
>>53649098
This thread is dead, just like Rust
>>
>>53649109
rust hasnt even been born yet. it's just been incubating
>>
// A function which takes a closure as an argument and calls it.
fn call_function<F: Fn()>(f: F) {
f()
}

fn print() {
println!("I'm a function! I can be used like a closure.")
}

fn main() {
let closure = || println!("I'm a closure!");
call_function(closure);

call_function(print);
}
>>
Rust changes the way you think.

At least for "ivory-tower" types, the only reason to learn new languages is for their power to change the way you think.2 Neither Go nor D really do this (at least for anyone who has previously programmed in C, Java, and Python), but Rust does a great deal. Rust requires programmers to think carefully about how objects are shared and used, and this changes the way you think about programs and algorithms.

Rust provides simple and safe concurrency mechanisms, and a useful and intellectually interesting task abstraction.

I'm not aware of any other language that has concurrency constructs as elegant and easy to use as Rust's spawn, and I don't know of any language that comes close to the race-free safety guarantees provided by Rust. The alternative with language like C and Go, is to have students get in the habit of writing programs riddled with data race bugs. Such programs tend to work well enough to be satisfactory for course projects (where the occasional crash or corrupted data is acceptable), but are increasingly unacceptable in the real world. The next step is to use available tools to detect races (e.g., Go's race detector), but these present another tool to use and learn about, are incomplete (only detect races that occur on executions), and much less satisfying than the static, language-based mechanisms provided by Rust.

Rust's task abstraction is somewhere between a thread and process: it provides the memory isolation safety of a process while allowing safe memory sharing, but with the lightweight costs of a thread requiring no context switching. This is a useful thing for programmers, but also a great thing for students to learn about and understand in an operating systems course. Along with the task abstraction, Rust provides good abstractions for communication between tasks including a simple channel abstraction and abstractions for shared mutable state.
>>
Rust provides strong memory safety guarantees, but still allows programmers explicit control over memory management.

The main alternatives provide two extremes: C provides no memory safety but fully explicit control over memory management; Go and D provide memory safety but with all objects being automatically managed with a garbage collector (over which languages users have little control). Rust provides a way for programmers to declare objects that are automatically managed or explicitly managed, and statically checks that explicitly managed objects are used safely. This is done using a notion of ownership, and type rules for controlling how ownership is transferred between references (e.g., you can pass an owned object temporarily to a function as a borrowed reference, and can have more complex ownership types to enable controlled sharing). These rules guarantee all memory is safely deallocated, and the sharing restrictions are essential for providing safe concurrency.

Rust provides good mechanisms for higher-order procedures, and many library types are designed in ways that encourage students to use them.

One of the biggest embarrassments about our department's standard curriculum is that students can reach a 4000-level class without ever encountering a higher-order procedure (as opposed to the sadly rarely-offered alternative intro course which introduces higher-order procedures in the first assignment), so I thought it was essential to use a language that supports higher-order procedures and provides good opportunities to use them effectively. Rust provides a simple syntax for lambda expressions, and lots of good ways of using them including in the RWArc abstractions we used in the starting code for PS3.
>>
>>53649379
With it strong emphaisis on safety, Rust still provides an escape hatch to allow students to experiment with unsafe code.

The Rust compiler normally disallows any code with implicit data races or unsafe memory use, but the language provides the unsafe construct for surrounding code that may be unsafe. This can certainly be abused (and I regret not providing some guidelines or rules to prevent students from overusing it, which some students did on some assignments), but is also very useful for being able to show simple but unsafe code and for understanding what is necessary to make code safe. For example, we used this in PS1 where students added an unsafe counter to a simple web server, and then in PS3 there was a problem where students had to implement it in a safe (race-free) way. The unsafe escape hatch also makes it possible to include assembly code in Rust programs, and to easily use libc.

Rust is open source and has an open development process.

The Rust source code is available for everyone to read, and the Rust language designers discussions are on an open mailing list. (Go is also open source and has an open developer discussion, so this is not a particular advantage of Rust over Go.)
>>
>>53649098
I'm deebly goncerned cargo turns out to be the next npm, aka a package manager that directly downloads from git repos and consists of thousands of tiny micropackages that enforce an extremely disastrous form of bitrot.
>>
>>53649364
>>53649379
>>53649397

didn't read lol
>>
I used to think Rust was amazing until I went back and seriously learned sepples and realized it had everything I cared about in Rust minus the borrow checker which is obnoxious and wrong a third of the time.
>>
>>53650458
Beside Ada and Zig which have no community for two different reasons it's one of the best shots for a new system programming language.
>>
>>53649364
>Rust changes the way you think

Yeah pretty sure that's just because it's a functional language
I hab the same thing with scheme and now I love functional programming
>>
>>53649596
I'm the opposite:
I started reading about Rust and realized that I should be using unique ptr more often in my C++ code. Now that my code is riddled with "std::move()" everyone other line, I'm really reconsidering if I should've used Rust instead.
>>
>>53651431
From what I currently understand, C++ has all the safety mechanisms that Rust has, but in Rust they're built into the language, and therefore better integrated (and faster).
But currently I have to learn like 50 different standard library features before I can actually start using Rust effectively...
>>
>>53651471
I'm not a Rust fan. But they have something C++ should have for years prior to a lot of other features and it shows that the committee doesn't know shit about what is important:
Fucking modules.
>>
>>53651534
MUH BACKWARDS COMPATIBILITY WITH CEE
MUH MAKEFILES
UNEEXXX
>>
>>53650940
this
>>
>>53651553
>MUH BACKWARDS COMPATIBILITY WITH CEE
Could easily have that with modules. They don't need to throw them out.
>MUH MAKEFILES
Who cares, they are a crap idea for new projects anyway and any halfway not that shitty part in ones build toolchain (ninja, cmake, qbuild and whatnot would instantly gain support to the next version)
>UNEEXXX
has nothing to do with it
>>
>>53649536
this is my only valid concern after playing with rust for a year
>>
>>53650940
>Ada
>New

Are you being serious?
>>
>>53649397
>>53649379
>>53649364
Thanks for the writeup. I've been wondering if I should take a look at Rust.
>>
>>53650940
>>53651608
>>53652224
The problem is if you want anything close to a Modern Ada compiler your paying >$15k. The open sauce gcc implementation doesn't fully cover the spec because nobody care to update it... because nobody uses it.

Ada missed it's chanced. Its nice to look back at what was, and could have been.
>>
>>53652875
Its also worth mention the cargo build-tool/package manager is awesome. Also units can be written as part of the source document, which really helps understand-ability and code correctness.
>>
>>53653057
>implying languages have a best before date
>>
Anyone who hates Rust is just assblasted that D and Go aren't capable of doing shit
>>
Why would you choose Rust over Swift(when it's more portable in 3.0)?
>>
>>53653752
If you don't already know the answer, then you know absolutely nothing about Rust.
>>
>>53653671
Rust programmers
>I won't use Ada. No one uses it.
>instead I'll use this obscure unfinished nonsense in favor of a well designed field proven language
>>
>>53653108
>units can be written as part of the source document
In what way? Little 1-2 line assertions, or full on test cases?

I've done something like this with Python, where I'll include an assert or two expecting basic correctness immediately after a function, so that if the module is ever really fubar, it won't even import.

Complete test cases, however, belong separate from the source. Tests get wordy, and having too large of source files is bad.
>>
>>53654140
It's better to get on board with something unfinished but promising then try to reinvent something that exists badly.

To resurrect Ada, you would have to maintain compatibility with everything that came before. If you don't, then you're not resurrecting it, you're forking it, and if you fork it you may as well tinker with the standard and make it something new.

If you do maintain compatibility, you WILL regret it. Ada is not a normal language: it's the old standard language of US military software, and it is still in use for that purpose. If you try to get into that world you will stab your eyes out with forks. If you don't, if you try to make Ada live two lives, you will inevidably be drawn into it. There'll be some chatter on the mailing list about some standard module or another, when someone will point out that functionality exists somewhere in the charnel pits. You'll try to stop it, but it won't work. Someone from Northrop Grumman will come in and say that the module was partially declassified in 2005 and can be made available if you fill out 18 different forms, light a black candle from a northern window, and put on the first act of The King in Yellow. Dependencies will creep in, you'll start getting entangled, a PM from General Dynamics Land Systems will ask to license part of your project in a humvee firmware update, the phrase "national security" will start bouncing around.

One day you'll wake up to an inbox of 194 different emails related to certification, standard compliance, inspection, and joint review. On that day you will turn off your computer and remain in the shower desperately trying to feel clean again until you die of starvation and the landlord finds your rotten, mildew infested corpse clogging the plumbing of the bathroom.
>>
>>53654487
Nice creative writing assignment, but Ada doesn't need resurrecting. It's still being maintained with a revision just a few years ago. All the effort that is going into this vanity project for Mozilla should be redirected to the Ada community.
>>
File: 1355067254768.gif (11 KB, 320x240) Image search: [Google]
1355067254768.gif
11 KB, 320x240
>>53654673
>All the effort that is going into this vanity project for Mozilla should be redirected to the Ada community.

It won't, so you're better off dealing with the way things are than pining for the way you want them to be. The argument is futile.
>>
>>53654673
My 1am comedy act has roots in truth: you will never pry Ada away from its status as a military language. If you try to expand it you'll be shackled by endless backwards compatibility demands and users refusing to use latest versions.
>>
File: 1417695863072.jpg (316 KB, 1455x771) Image search: [Google]
1417695863072.jpg
316 KB, 1455x771
>>53653057
>The open sauce gcc implementation doesn't fully cover the spec because nobody care to update it
Is this true? Adacore makes practically every new thing from their commercial (i.e. supported) compiler open source after a year or so. And I never missed something in their Libre version.
>>
Question for the Rust fans: would you fly on an airplane that uses Rust for its computers? Would you bet your life and the lives of your family on the quality of Rust?

No? Then fuck off with your 'Ada is over' shit.
>>
>>53649098
>Haskell done right

It's really not, it doesn't even have a dependent type system.
>>
>>53655145
Ada fits perfectly into the professional engineering sector. Ada has gone through major revisions before, and will again in 2020 I believe. Massive revisions aren't great for hobbyist, but if you're looking for consistency, an unfinished language isn't what you should be looking to.
>>
Didn't they use C++ for the JSF? C++ as a language isn't any safer than Rust. Although obviously C++ has higher quality implementations.
>>
>>53654140
rust is 1.7, folk
>>
>>53654193
>having too large of source files is bad.
for u, python user
>>
>>53655429
It's bollocks
>>
>>53656120
For anyone sane.
Digging through thousands of lines of unrelated code isn't fun.
>>
Most of what people like in Rust is already in C++, just with some God awful syntax sometimes. Also, RAII is optional in Rust... Which is nice, because I've heard a few complaints about C++ calling constructors when it would not be the most performant choice.

If more people start using Rust and it gets more libraries, I may consider investing more time into it.
>>
>>53653671
They have.

Take for example Tcl, that stuff will never rise again.
>>
>>53653057
That's not the problem.

The problem is, there is no community for non-mission-critical stuff, because nobody wants to use a free as in freedumb only compiler.
Thread replies: 46
Thread images: 4

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.