17 ms·
The Rust Programming Language
- cnlwsu 15y agoIn chrome I am just getting a blank page with some javascript errors. In IE I only can see the right half of the presentation. Mozilla is supporting FF well though :)
- elisee 15y agoWorks fine in Chrome (dev channel) here. I was a bit surprise to have load times (spinning wheel & all) between each and every page though.
- Nogwater 15y agoNo errors for me in Chrome 14 on Win7. It is broken in IE 9.
- cnlwsu 15y agoI am running Chrome 14 in Win7... After a little debugging it looks like it was actually my MeasureIt! extension that broke it.
- pcwalton 15y agoI just used Keynote's export feature. I'll upload to slideshare.
- keithpeter 15y agoJust dump a pdf of the slides in your dropbox, less hassle. Works ok in FF on Xubuntu 11.10 but sloooooowwwwwwww
- captaincrowbar 15y agoSeconded. Please just give us a plain old PDF that we can read in-browser or download, instead of making us screw around with all these weird friggin formats.
- pcwalton 15y agoHere you go: http://dl.dropbox.com/u/4186469/rust-all-hands-w2011.pdf http://dl.dropbox.com/u/4186469/rust-all-hands-w2011.pdf
- masklinn 15y agoMay I suggest speakerdeck[0] instead of or as well as slideshare? I've seen a pair of slide decks on it lately and it's been a much, much better experience than consuming through Slideshare: it's faster, more reliable, it looks better and it's not flash. [0] http://speakerdeck.com/ http://speakerdeck.com/
- idonthack 15y agoI tried to fullscreen it, but i couldn't because they intercept keystrokes. So i fullscreened and then clicked on the link, but then i couldn't get out of full screen or close the tab because they intercept keystrokes.
- GeneralMaximus 15y agoWorks great in Opera Mobile on my Android, though.
- pcwalton 15y agoSlideshare here for those having trouble with the Dropbox-hosted version: http://www.slideshare.net/pcwalton/rust-all-hands-winter-2011 http://www.slideshare.net/pcwalton/rust-all-hands-winter-201...
- capnrefsmmat 15y agoCould you give examples of macros-by-example, as the presentation puts it? I'm not sure how those would work in a non-Lispy context.
- pcwalton 15y agoCheck out the macro tests in this directory: https://github.com/graydon/rust/tree/master/src/test/run-pass https://github.com/graydon/rust/tree/master/src/test/run-pas...
- ynniv 15y agoGood call on single threaded language bridging. Multithreading in XPCOM was either bad or worse depending on the phase of the moon. I almost had an important project tank because XPCOM "out" parameters (unfortunately used internally whenever a method had a return value) were not thread-safe. We ended up using a different threading library and only making synchronous XPCOM calls.
- zobzu 15y agoIt looks pretty cool and oriented at making a browser engine. (tl;dr version i guess)
- icebraining 15y agoOlder discussion: http://news.ycombinator.com/item?id=1498528 http://news.ycombinator.com/item?id=1498528
- andrewflnr 15y agoMaybe I'm just naive, but whenever someone says "systems language", I think "ooh, something better to write kernels in?" I guess I'm waiting for something semantically equivalent to C, but with better options for macros and code generation, and some compile-time guarantees. Just less tedium, more DRY. I don't actually program C, I just have projects in mind where it seems like that's the best language, where performance and compatibility with other languages is important. But C seems like such a pain to program in that I really wish there was a better option.
- mkramlich 15y agoconsider D by Walter Bright. he hangs out here too.
- pcwalton 15y agoRust has an unsafe sublanguage you'll probably be interested in. That said, writing kernels is explicitly not a goal of Rust. It may well work great with a custom bare-metal runtime, but we aren't letting the needs of OS kernels constrain our design space at this time.
- pjscott 15y agoIn this case, they're looking to write a large portion of a web browser in this language. That's practically a kernel, these days, and the language looks well-suited to the task. It's ambitious, definitely, but the world needs more ambitious things that will be amazing if they succeed.
- mvzink 15y agoHonestly, I feel like people are too scared of C, and sometimes I think that derives from ignorance about systems (and not quite the type of systems Rust is supposedly dealing with, I don't think; but I didn't finish the slideshow). Read CS:APP; you'll learn C and systems at the same time, and see why C isn't so scary after all, but systems are. (This is just based on conversations I have had, I'm not assuming this would be appropriate for you, andrewflnr!)
- thurn 15y agoThe typestate concept seems like an incredibly cool tool for enforcing static guarantees. As far as I'm aware, not even Haskell has anything similar to that (feel free to correct me!)
- thyrsus 15y agoI'm not clear: is typestate a compile time or run time guarantee? [Edit] That is, is the guarantee implemented at compile time, noting violations similarly to syntax violations, or does it generate "invisible" code that performs runtime checks which can throw something similar to exceptions?
- cwp 15y agoA bit of both, actually. It's mostly compile-time checking, but you can also write assertions about the typestate of a particular variable. The compiler generates code to check the actual values at runtime - if the assertion fails, the program is aborted. The really cool bit is that the compiler can take the assertions into account when compiling code that follows the assertions.
- divtxt 15y agoIt's like design by contract (preconditions/postconditions) without classes. Interesting parallel to how Go has interfaces without classes.
- divtxt 15y agoI like the concurrency trend - channels & cheap threads like Erlang and Go. The concurrency feature that stands out: ... no need for ... concurrent garbage collection. (slide 17) The upside should be amazing performance compared to simple GC. The cost is developer effort for memory management hints (slide 22). We'll have to see if it's worth it.
- noj 15y agoI'm really looking forward to Rust being somewhat usable, I think it has made almost all the right choices. This is Google Go done right. As a C++ developer I find my efforts on "memory management hints" to be totally worth it, due to the fact that you actually have to think about object ownership. Which in my mind makes for better designs.
- deleted 15y ago[deleted]
- hasenj 15y agoI saw the C++ like syntax with std::stuff and stuff<T> and it turned me off.
- loup-vaillant 15y agoI saw the ML like syntax with `let r = 42 { stuff };` and it turned me on. Frankly, your bits of syntax are no worse than `Std.stuff` and `'a stuff` (or `Stuff a`).
- pcwalton 15y agoSee my comment above for the stuff<T> issue. As for std::stuff, in earlier versions we wrote std.stuff, but it actually hurt readability (not to mention complicated typechecking), since '.' is also used for record field projection and object method invocation. In the MLs it's not so bad because module names have to begin with a capital letter, but we tried to avoid making case significant.
- DanWaterworth 15y agoThis looks like it's going to be a great language. Compiling to LLVM should mean that it does tall call optimization, which is great and also means that integrating with C/C++ should be fairly easy. The only thing it's missing that I'd like to see is support for CPS conversion like streamlinejs does. Even if it supports growable stacks that start at 1KB, with thousands of threads CPS conversion is still more efficient. Having said that, seeing as they are writing browsers, not servers, I can see why it's not a priority to do this.
- beagle3 15y agoCan you explain how CPS solves the growable stack problem? I haven't heard of this before.
- ori_b 15y agoIt essentially lets you turn your stack state into closures on the heap which are passed to tail recursive functions.
- beagle3 15y agobut how is that related to CPS? (or closures for that matter?) If you're allocating the stack frame on the heap, you can just replace the prologue (e.g. x86 intel syntax, cdecl calling convention) sub esp, LOCAL_SPACE_NEEDED with push LOCAL_SPACE_NEEDED push ARG_SIZE_TO_COPY call allocate_frame (where allocate_frame allocates enough space for storing link to previous stack frame, all args and all locals; then, it copies all arguments, return address and stack pointer, switches stacks to the new stacks and returns from the call) You can modify the return to call "deallocate_frame" (which would switch stacks back before returning), or you can just make sure the return address on the new stack points to "deallocate_frame_and_return", and use a regular return in place. [Actually, come to think of it, it's an excellent idea for a stack protection system that can be turned off for speed - the call to "allocate_frame" could be configured at runtime to patch its caller to just do "sub esp, LOCAL_SPACE_NEEDED" for maximum speed. Or it could just check stack overflow; or it could allocate frames on heap for better memory use; and it could mprotect/virtualprotect the edges of this frame for protection]
- tomp 15y agoSometimes I wonder why do all the programming language designers prefer to invent several different syntaxes for one concept... From the third slide: we can see two different function definition syntaxes, a "normal" style and a "ruby" style. I really like the way of JavaScript, CoffeeScript and OCaml that have a single unified function syntax. Also on this slide: why have a special syntax for importing submodules from modules/crates? Again, CoffeeScript excels here, an import is simply a variable declaration: {int, vec} = require('std') Furthermore, it has always bothered me why generic types use <> brackets. I can understand it in Java and C# (where types are declared before values/functions), but in Rust, it's really unnecessary to introduce the 4th type of brackets into the language (apparently, they used [], but latter changed it to <>... I would really like to know why.)
- Dn_Ab 15y agoI am not trying to correct but clarify what you mean by unified syntax. In OCaml you can say let rec func = ... , let func = ..., let func = function |... | _->... and let func = fun ... -> ... Now I find that each of these variations make good sense and would call them unified facets but they tripped me up many years ago when I was first learning the language.
- tomp 15y agoThat's true, and there is also let func a b c = ..., and most of these are just syntax sugar, mainly useful at the module level. The important thing is, though, that the function declaration syntax is the same as the "inline" function syntax, I can easily say: let f = function 0 -> false | 1 -> true use (f) and then refactor the code into use (function 0 -> false | 1 -> true) That's the consistency I'm talking about...
- philh 15y ago> {int, vec} = require('std') I don't know coffeescript, but this looks to me like "std exposes two things, and I am bringing them into this namespace as int and vec". Whereas the rust code looks like "std exposes int and vec, which I am bringing into this namespace, and possibly other things which I am not".
- mkup 15y agoI'm writing this comment in hope that Rust language designers read this thread. It's very important to language designers at this time to avoid stop-the-world GC approach in Rust at any cost. Google Go is beautiful programming language, but its key limitation is stop-the-world approach to GC which makes it very difficult to implement highload web servers, DB engines and other software with strict max-time-to-response requirements. Recent research [1][2] suggests that "normal" Go program spends more time collecting garbage than performing actual calculations. [1] https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf https://days2011.scala-lang.org/sites/days2011/files/ws3-1-H... [2] http://www.theregister.co.uk/2011/07/01/go_v_cpluplus_redux/ http://www.theregister.co.uk/2011/07/01/go_v_cpluplus_redux/ Go programming language has gone too far to separate owning and non-owning pointers at syntactic level, to disallow changeable global variables, to enforce rules like "each mutable object is accessible from only one thread", and introduce other means to avoid GC. But Rust is new and young, already has 2 types of pointers, and it could avoid GC by RAII and reference counting. Objects linked in cycles with owning pointers would cause memory leaks, and I think this behaviour may be left as is, kinda "it's not a bug, it's a feature". Weak pointers could point to intermediary descriptor which holds owning-refcount and nonowning-refcount. Weak ptr behaves like a NULL if owning-refcount is zero and target object is already destroyed. This is to guarantee safe memory model. In short please take all means to avoid main Go defect "Garbage collection takes more CPU time than actual computations". Please avoid stop-the-world GC approach which makes the language almost useless for real applications.
- ori_b 15y agoThat's more that go has an incredibly crude GC (which is in the process of being replaced, as far as I know), and less that it is fundamentally broken. Other language and GC implementations with a large shared heap can work fine. See, for example, Azul systems' JVM.
- nickik 15y agoAzul systems GC has Hardware and OS support that you don't have normally but I do generally agree.
- LeafStorm 15y agoThis is probably minor, but one of the things that bugs me is the incredibly shortened keywords. Is it really that much of a slowdown to type "function" or even "func" instead of "fn"? Same with "ret" instead of "return".
- markokocic 15y agoIt is hard. Each time when I have to define callback inside callback inside callback using anonymous functions in javascript, I wish they chosen something shorthe than "function".
- BoppreH 15y agoThe problem is not typing speed, but word size. It fills the screen with garbage and is typo-prone. Small reserved words means I don't have another failed compilation because I typed "fucntion", or the small but significant mental pain of backspacing.
- Wilduck 15y agoA huge one for me is that for some reason I can never correctly type the word "Length". As if to highlight my point to myself, I consciously thought about how to type it, and still ended up with "lenght" on the screen. Python's built in function "len()" is a lifesaver in this regard.
- ori_b 15y agoSkimmability also suffers with long keywords.
- igouy 15y ago> Same with "ret" instead of "return" And if we're going to have something so devoid of obvious meaning as "ret" why not go the whole way down to a single character? Smalltalk which I generally consider to be a verbose language manages quite nicely using "^" to indicate an explicit return- ^answer
- madmoose 15y agoI only have a tiny bike-shedding comment: I'd expect the arguments of the map-function in the example on page 3 to be the other way around. The 'grades' argument gets pushed down several lines in the current form.