News for hackers. Stuff that matters.
Re:Announcing Rust 1.13 by lomnakkus on Thursday November 10, 2016 @04:41PM (#12924668)
While it may be convenient, it's truly worrying such (EDIT: was "many") syntactic special cases are going into Rust at this point.

(It may be the case that these things absolutely cannot be handled in a systematic way in a no-GC/no-runtime language, but I'd really like to see some evidence that this is the case.)

Re:Announcing Rust 1.13 by Manishearth on Thursday November 10, 2016 @04:57PM (#12924831)
> how many

I can only think of one redundant feature, and that is the ? operator. This is because `try!` gets used very often in in a lot of code.

I can only think of one syntactic feature (redundant or otherwise) that doesn't get used often and that is HRTB(`for<'a>`), which needs to be there to be able to specify some types correctly (but is very rare).

Re:Announcing Rust 1.13 by Gankro on Thursday November 10, 2016 @06:28PM (#12925671)
Almost every control flow mechanism in Rust is redundant: `if (let)`, `while (let)`, and `for` are all encodable with loop/match/break. Even `return` and `continue` are arguably redundant. Control flow is also probably the biggest source of redundant functions (map, and_then, or_else, unwrap, etc...).

In this sense, ? is following in a long tradition.

Re:Announcing Rust 1.13 by Manishearth on Thursday November 10, 2016 @06:37PM (#12925752)
Ha! Fair point.
Re:Announcing Rust 1.13 by lomnakkus on Thursday November 10, 2016 @05:02PM (#12924880)
If you have enough abstraction capability (HKTs, for example), try! is also redundant... and you can instantly generalize to anything that isn't necessarily a `Result` but has the same general structure.

By special-casing now, one almost-certainly[1] closes the opportunity for future consolidation.

[1] I say almost because it's not necessarily a done deal, but migration gets exponentially harder the longer a language has been "out in the wild". GHC/Haskell has gone through a similar upheaval in the last 1-2 years and it wasn't pretty... but ultimately it seems to at least have survived, so there's that.

Re:Announcing Rust 1.13 by Manishearth on Thursday November 10, 2016 @05:12PM (#12924974)
> and you can instantly generalize to anything that isn't necessarily a `Result` but has the same general structure.

>

> closes the opportunity

The door isn't closed for this, `?` works with a "carrier" trait, which lets you extend the operator. Now, it's currently unstable, so right now you can't use it, but the door is wide open for the design of `Carrier` to be finalized.

This was explicitly discussed and thought out before ? was stabilized. It's just that ? was stabilized before Carrier.

The compiler knows nothing about `Result`. There are very few structs that it knows anything about, and these all have to do with atomics or `UnsafeCell` or other intrinsic-based primitives that you don't need to reimplement out-of-tree anyway. It knows a few traits, like Add and Copy and Carrier, which can be used to extend operators and stuff.

Re:Announcing Rust 1.13 by lomnakkus on Thursday November 10, 2016 @05:18PM (#12925032)
> The door isn't closed for this, `?` works with a "carrier" trait, which lets you extend the operator. Now, it's currently unstable, so right now you can't use it, but the door is wide open for the design of `Carrier` to be finalized.

Oh, OK that at least sound like sound "defensive design" -- good to hear :). However, what happens if `Carrier` needs to be radically redesigned, e.g. to account for HKTs or Rank-N types (or something similarly 'crazy').

Re:Announcing Rust 1.13 by Manishearth on Thursday November 10, 2016 @05:27PM (#12925107)
Carrier itself is unstable, so it can be redesigned into whatever it wants to be. The only restriction is that it should continue to work with Results the way it does now, and that's an easy thing to maintain. It could be made into an HKT trait thingymajig. It will probably just be a trait with two associated types, this is very close to HKT anyway.
Re:Announcing Rust 1.13 by steveklabnik on Thursday November 10, 2016 @05:07PM (#12924936)
While this is true, it's not clear if Rust will ever get the stuff needed for do notation, some believe that it's impossible. And people need to reduce their error-handling boilerplate today.

Rust will certainly have warts. Maybe someday in the future we'll feel like this is one of them, maybe not. :)

Re:Announcing Rust 1.13 by lomnakkus on Thursday November 10, 2016 @05:11PM (#12924967)
> it's not clear if Rust will ever get the stuff needed for do notation, some believe that it's impossible

True, and I think I acknowledged as much in my original comment.

> And people need to reduce their error-handling boilerplate today.

Indeed, I'm just (vaguely) worried about Rust being painted into a corner. As I said in my OP, it may actually be an unavoidable corner -- I hope not, but as you say... I guess we'll see :).

Re:Announcing Rust 1.13 by bascule on Friday November 11, 2016 @01:55AM (#12928575)
This is a standard operator found in many programming languages, including ones with GC:

https://en.wikipedia.org/wiki/Safe_navigation_operator

To the contrary of what you're suggesting, I think Rust has done a great job eliminating a lot of the previous special-cased syntax and rebuilding things upon a simplified set of core primitives.

Re:Announcing Rust 1.13 by masklinn on Friday November 11, 2016 @04:55AM (#12929292)
It has very different semantics in Rust than it does elsewhere though.
Re:Announcing Rust 1.13 by nercury on Thursday November 10, 2016 @04:56PM (#12924818)
Not sure what you are talking about - it is the first bigger syntax addition since 1.0, and I actually want more.
Re:Announcing Rust 1.13 by steveklabnik on Thursday November 10, 2016 @04:41PM (#12924671)
Which ones specifically worry you? I can't think of many, but I am also incredibly biased.
Re:Announcing Rust 1.13 by lomnakkus on Thursday November 10, 2016 @04:59PM (#12924844)
Sorry, phrasing was bad. I've edited.
Re:Announcing Rust 1.13 by steveklabnik on Thursday November 10, 2016 @05:01PM (#12924869)
No worries, it happens.

What worries you about it? What things need to be "handled in a systematic way"? Are you just generally opposed to any new syntax in languages or something?

Re:Announcing Rust 1.13 by lomnakkus on Thursday November 10, 2016 @05:03PM (#12924885)