I haven't written anything in Rust yet but one of its most interesting aspects is its support for linear types. I expect that will share the same kind of perspective enriching attribute of learning logic, array or functional paradigms. While it's certainly not the first language to support substructural types, it looks the only one with a decent chance of developing a meaningful ecosystem. The linear logic of J.-Y. G…
New Rust runtime turned on. What next?
51–60 of 118 posts
Re: New Rust runtime turned on. What next?
#52Earlier quoted context omitted.
I think its much less common in language design then we might give it credit for. Many languages run on a VM that is written in C including the likes of Java, Javascript, C#, Ruby and Python ( even PyPy compiles down to C ). I am sure there are others besides C that are self sustaining, but they are _very_ rare
I think you have a somewhat inaccurate mental model of how things are done. For one, it doesn't really make sense to talk about the CLR when you talk about bootstrapping C#. My project (the Roslyn C# compiler) is a 100% C# implementation of the C# compiler. One thing to keep in mind is that we don't target the CLR. The C# compiler is not a compiler from C# to the CLR, it's a compiler from C# to the CIL (Common Interm…
Re: New Rust runtime turned on. What next?
#53Excerpt from Graydon's (BDFL) reply: > Despite all these caveats I have a very strong sense that writing the > runtime in Rust will go a long way to validate Rust in the domains it's > aiming for: concurrent and systems programming. Even in the task > scheduler, where there's quite a bit of unsafe code, the shared-nothing > nature of unique types forces you to consciously break the type system > to share memory, and…
I, too, think Rust is going to be revolutionary in the video game industry. Were I a game programmer I would start learning now. In two years at least 51% of all new video game code will be in Rust.
* Games require portability. Not many platforms will have a rust compiler (Not to mention that current C++ compilers are very mature and highly optimizing).
* Current C++ libraries. They are probably heavily templates-based and will be difficult to port.
Re: New Rust runtime turned on. What next?
#54I really wish I had space in my TODO list to start a project in Rust. I don't think there's another dev tool I'm more excited about.
I'm feeling the same way, Rust looks fantastic. There are a few things in the language I'm not huge fan of, I don't like overly subtle things in a language. For example, some of the functionality around semi colons seem like they will be a common source of stupid programmer bugs that are difficult to track down. Perhaps the compiler will catch that stuff. Go kinda ruined other languages for me with multiple return va…
addsub = function(a, b) return a + b, a - b end
a, b = addsub(32, 44)
And if you run that code with LuaJIT it compiles down to a few machine code instructions, no object creation at all, no function call.In contrast I think at least in Python the tuple based solution would be horribly inefficient because it allocates/deallocates a new object every time just to pass values. I don't now if the Rust compiler is smart enough to optimize the tuple creation away.. but I doubt it.
Re: New Rust runtime turned on. What next?
#55Earlier quoted context omitted.
Multiple return values is possible with n-tuples. fn addsub(a: int, b: int) -> (int, int) { (a + b, a - b) } ... let (a, b) = addsub(32, 44);
Indeed, the behavior described here is just a consequence of allowing pattern-matching when assigning variables. Say you wanted to do the Python trick of swapping two values: let a = 1; let b = 9; let (b, a) = (a, b); printf!("a: %i, b: %i", a, b); // a: 9, b: 1 ...or say you just wanted to grab a single item out of a tuple: let x = (1, 2); let (_, y) = x; // the underscore is the pattern for "ignore this" printf!("y…
b, a = a, b
is actually valid code in Lua (and works as expected).Grabbing only one value looks like this
_, y = returnsTwoValues() -- grab only the second
y = returnsTwoValues() -- grab only the firstRe: New Rust runtime turned on. What next?
#56Earlier quoted context omitted.
I'm feeling the same way, Rust looks fantastic. There are a few things in the language I'm not huge fan of, I don't like overly subtle things in a language. For example, some of the functionality around semi colons seem like they will be a common source of stupid programmer bugs that are difficult to track down. Perhaps the compiler will catch that stuff. Go kinda ruined other languages for me with multiple return va…
I have limited experience with Rust, but the semicolon stuff you're describing has been one of the most surprisingly positive aspects about it for me. I thought it sounded kind of like a dumb gimmick that just adds subtlety (read: removes simplicity) to something for no reason. However, in practice I've found is really great for making the intent of your code more visible (less cluttered). I miss it when I'm doing C#…
Also, the type checker ensures that you'll hear about it if you lack a semicolon and emit a value other than unit from a block, without then using it.
Re: New Rust runtime turned on. What next?
#57I tried to give Rust a try to build some stuff but my project required HTTP and there's no easy SSL solution in place right now. Hope it comes along. I don't have time to contribute much otherwise I would.
To quote Brian Anderson (the OP), one of the next steps in the I/O rewrite is "Implementing a new HTTP client on top of rt::io, possibly using Chris Morgan's HTTP code, for use in Servo". So hopefully within the year we'll see the beginnings of a robust HTTP lib that's worthy of a Mozilla-brand browser engine.
Re: New Rust runtime turned on. What next?
#58Earlier quoted context omitted.
I, too, think Rust is going to be revolutionary in the video game industry. Were I a game programmer I would start learning now. In two years at least 51% of all new video game code will be in Rust.
You forget a few points: * Games require portability. Not many platforms will have a rust compiler (Not to mention that current C++ compilers are very mature and highly optimizing). * Current C++ libraries. They are probably heavily templates-based and will be difficult to port.
Rust uses LLVM as the backend, so any platform that Clang supports, Rust can too. (And also, it has the optimisations built in.)
In fact, there's already support in the compiler for x86, x86-64, arm, and mips. (I'm not sure if mips actually works, but arm definitely does.)
Re: New Rust runtime turned on. What next?
#59Earlier quoted context omitted.
I, too, think Rust is going to be revolutionary in the video game industry. Were I a game programmer I would start learning now. In two years at least 51% of all new video game code will be in Rust.
I think you may be overestimating the pace of change. C++ is quite entrenched for industrial-strength game projects. The network effect is strong, the tooling is mature, and the projects are largely driven by C++ experts. Even if we see Rust 1.0 by the end of the year, it will take a lot of time for that kind of change to occur in the industry, if it ever does. I think you're much more likely to see 51% of new game c…
Re: New Rust runtime turned on. What next?
#60I really wish I had space in my TODO list to start a project in Rust. I don't think there's another dev tool I'm more excited about.
I'm feeling the same way, Rust looks fantastic. There are a few things in the language I'm not huge fan of, I don't like overly subtle things in a language. For example, some of the functionality around semi colons seem like they will be a common source of stupid programmer bugs that are difficult to track down. Perhaps the compiler will catch that stuff. Go kinda ruined other languages for me with multiple return va…
It will, because the semicolon in Rust actually has a semantics impact: `a` has type T(a) but `a;` has type Unit (~void).
> Go kinda ruined other languages for me with multiple return values
That's sad, because Go has one of the worst MRV implementations out there: it's a special case of the language itself.
In most languages with MRV — and that includes Rust, but also MLs, Haskell, Erlang, Python or Ruby — MRV is simply a natural consequence of being able to unpack or pattern match containers (tuples and/or lists depending on the typing discipline).
Anyway Rust has multiple return values, don't worry about that.