mozilla/rust — Issue #1716: RFC: Exempt .field from forms-not-allowed-after-block-calls
Author: marijnh
Created: 2012-01-31 12:29:40+00:00
State: open
Labels: rfc

So, playing with monads, I really wanted to do this:

optval.bind {|v| if something() { some(v + 1) } else { none }}
.bind({|v| some(other_operation(v))}

i.e. chaining bind calls together. Such a thing is probably also useful in other minilanguage-like abstractions. It seems this syntax introduces no ambiguities -- expressions can not start with a dot token (`.5` is a number token).

I guess allowing this doesn't make the rules any harder to explain -- in fact, there are fewer exceptions (now just calls and []-indexing) to enumerate.