News for hackers. Stuff that matters.
Re:Announcing Rust 1.0 by azdle on Friday May 15, 2015 @02:57PM (#9552847)
For anyone that hasn't played around with rust yet, this is why I'm excited about rust: https://github.com/Azdle/hello-gtk.rs/blob/master/src/main.r...

That is a GTK GUI application that makes HTTP requests in under 40 lines of code.

Don't get me wrong I love all the safety gaurentes and what not, but just being able to write quick simple apps that would usually be a pain to write in C is a game changer for me. A lot of this is down to Cargo (the Rust package manager, very npm-like imo) and all the great rust libraries that already exist. I'm super excited to see where this goes now that it's 1.0, people can stop worrying about breaking changes in the language and just get down to writing libraries to do everything.

Re:Announcing Rust 1.0 by lmm on Friday May 15, 2015 @04:50PM (#9553608)
Why is that exciting? You've been able to do that almost line-for-line in Python for at least 8 years, if you're not bothered about the "safety guarantees and what not".
Re:Announcing Rust 1.0 by azdle on Friday May 15, 2015 @05:34PM (#9553822)
Admittedly, I've never tried using GTK from python and that seems like it does take care of a lot of the "easy" that I'm liking here. However, it's really the combination of everything that rust offers while still letting you make short programs like this.

I really don't mean the downplay all the safety stuff, that is the main reason that I'm interested in rust. I just don't feel like the fact that you can do things so easily in rust gets enough attention.

My biggest "Oh my god, that was awesome!" moment was when I first built the project and Cargo just took care of the whole dependency tree and I never even had to think about it. I've never had that in a low level language before. I've actually been stepping out of a lot of the C that I've been doing into doing more with JS just because NPM makes it so damn easy to whip something up. I'm hopeful that rust will let me come back to a much lower level where a 10MB binary is really large.

Re:Announcing Rust 1.0 by pornel on Friday May 15, 2015 @06:49PM (#9554149)
Rust is not a replacement for Python, but a replacement for C.

It's exciting that you can have power, portability and speed competitive with C, but with syntax and safety so good that you're comparing them to Python :)

Re:Announcing Rust 1.0 by dragonwriter on Friday May 15, 2015 @07:02PM (#9554205)
> Rust is not a replacement for Python, but a replacement for C.

I think its a mistake to view any language as simply a 1:1 replacement for an existing language. Newer languages can have the greatest strength in an area currently dominated by one older language (say, Rust with C), and still be better for some applications where another older language would generally be preferred to the first (say, Rust being better than Python at some things where Python would generally be preferred over C.)

Re:Announcing Rust 1.0 by nwmcsween on Sunday May 17, 2015 @12:55PM (#9560705)
Rust is a replacement for C++ not C
Re:Announcing Rust 1.0 by e12e on Friday May 15, 2015 @09:45PM (#9554692)
Python is great for prototyping - perhaps especially GUI. But it's not so great for distributing an app.
Re:Announcing Rust 1.0 by lmm on Saturday May 16, 2015 @03:54PM (#9557386)
Huhwhat? You distribute it like any other - look at the original bittorrent client, or the HP printer tools.
Re:Announcing Rust 1.0 by copsarebastards on Friday May 15, 2015 @05:47PM (#9553880)
Why are you not bothered about the "safety guarantees and what not"? Note that "what not" includes a lot of performance and portability which Python will likely never have, but Rust might.
Re:Announcing Rust 1.0 by sho_hn on Friday May 15, 2015 @03:16PM (#9552975)
I agree this is a very good thing by itself, but let's be clear that the extremly poor programmer ergonomics of the GTK-via-C stack have been superseded by nicer kit long ago (even within the GTK community).
Re:Announcing Rust 1.0 by GarryManson on Friday May 15, 2015 @03:25PM (#9553028)
Seems like theres no good reason for rust to do this when vala can -- and better, it just compiles to the same C
Re:Announcing Rust 1.0 by madez on Friday May 15, 2015 @04:00PM (#9553267)
Vala has reference counted garbed collection, while Rust doesn't need that. Also, Rust verifies, among other things, the absence of data races.
Re:Announcing Rust 1.0 by GarryManson on Friday May 15, 2015 @05:22PM (#9553759)
That's not much good when you're just talking to ahitty GObject APIs that - guess what! - use reference counted GC and have lots of race conditions. You gain nothing
Re:Announcing Rust 1.0 by pcwalton on Friday May 15, 2015 @06:11PM (#9553997)
Yes, you do. Your internal logic doesn't need the overhead of reference counting and can be race-free.

This is how Mac apps tend to be fast: the high-level application logic is reference-counted and uses relatively slow Objective-C dynamic method calls, but things that are performance critical (CoreGraphics, VideoToolbox/AudioCodec, OpenGL, sqlite, the Mach kernel) are written in C and C++.

Re:Announcing Rust 1.0 by sho_hn on Friday May 15, 2015 @06:16PM (#9554031)
This is also a general pattern in Rust, cf. unsafe blocks: You wrap code that doesn't adhere to Rust's strict rules (e.g. because it interacts with C) in unsafe { }, disabling various compiler checks and requiring you to check it for correctness manually. Unsafe-ness doesn't bubble up, though, i.e. having an unsafe block within doesn't taint, say, a function - allowing you to silo nasty things away and enforce strict checks around it.
Re:Announcing Rust 1.0 by SamReidHughes on Saturday May 16, 2015 @12:20AM (#9555050)
Heck, when doing Objective-C I'd drop down to C++ as quickly as possible just because the language is nicer. I'd be even more inclined to drop down to Rust.
Re:Announcing Rust 1.0 by pekk on Friday May 15, 2015 @08:22PM (#9554449)
I haven't noticed that Mac apps tend to be faster than apps on other platforms. Can you provide a citation for this?
Re:Announcing Rust 1.0 by pcwalton on Friday May 15, 2015 @08:32PM (#9554482)
I didn't mean "faster than other platforms", just "not slow". Really it's a testament to the fact that front-end glue logic can often be written in whatever language you want without compromising interactive performance (as long as the implementations of those languages don't require long pauses or something like that), which is something we've known for a long time.
Re:Announcing Rust 1.0 by luuio on Friday May 15, 2015 @04:27PM (#9553449)
Not that it's not amazing, but can't i'm pretty sure most languages can do that same thing.
Re:Announcing Rust 1.0 by moonchrome on Friday May 15, 2015 @04:58PM (#9553653)
Does this build with something simple like "cargo build" ? It should but I can't test right now on this PC.

If it does than I would disagree - not many other native languages can do that - having a native language with a sane build system, package management and proper modules would be a huge deal on it's own.

Re:Announcing Rust 1.0 by azdle on Friday May 15, 2015 @05:26PM (#9553780)
Yes it does. I just do a `cargo run` and it figures out the dependencies, builds, and runs.
Re:Announcing Rust 1.0 by e12e on Friday May 15, 2015 @09:53PM (#9554709)
Just tried, and it's both a little frighting and a delight to see cargo pull down and build the dependencies. For the information of those that can't test at home, the stripped release build weighs in at 722K, and worked on first try on my Debian Jessie system. Woho!

You might want to add a CC0 license to the project (or something else, but that's usually what I see recommended for "sample code").

[ed: and:

   ldd ./target/release/hello_gtk |wc -l
   59
]
Re:Announcing Rust 1.0 by imaginenore on Friday May 15, 2015 @07:08PM (#9554223)