[rust-dev] statement-expressions and block-terminators

Graydon Hoare graydon at mozilla.com
Wed Nov 24 09:59:45 PST 2010


On 10-11-24 09:06 AM, Patrick Walton wrote:

> An alternate way of thinking about proposal #3 is that, as a rule of
> thumb, ";" always means "ignore the result of the previous statement".
> Formulating it this way might ease the cognitive load on users.

While I always appreciate having new ways of explaining a language 
feature, I should relate a certain pithy phrase often related by Lessig 
about politics, which applies equally to languages: "if you're 
explaining, you're losing".

Our business here is, in a large measure, to anticipate what users will 
*already* be thinking, and to figure out something that fits well enough 
to be unsurprising, palatable.

(While, of course, having superior precision and safety properties than 
the sum of their vague and contradictory expectations :)

The problem is that our target market is largely people from statement 
languages, who simply don't have this issue. So modeling their 
assumptions directly means "various other techniques" to solve the same 
design pressures -- ternary expressions, use of subordinate functions 
with inlining and constexpr modifiers ... -- and we're sort of taking a 
sober second look at that whole path and wondering if the 
expression-language people live in a substantially better world. And if 
so, how to get there without losing the statement-language audience.

Hard/subtle/tradeoffy design issue.

-Graydon


More information about the Rust-dev mailing list