fn heresy() -> &str { "I am the corruption lurking in your heart" }
And not a semicolon in sight. Disgusting.fn heresy() -> { "I am the corruption lurking in your heart" }
However, closures are allowed to have all of their types inferred. This is because closures aren't allowed to exist at the top level of a file (in what's called "item position"), and so you don't really have to worry about them being used by others. The closure equivalent of the heresy example would be:
// Note that the braces in this line are optional
let heresy = || { "I am the corruption lurking in your heart" };
// Though you're still allowed to be explicit, if you'd like
let heresy = || -> &str { "I am the corruption lurking in your heart" };edit: Ho ho ho, I can't count. And we don't really have a 5-character-max criteria, but we do prefer shorter keywords.
I'm curious as to how this conclusion was reached.
:D Honestly, I think either ret or return is fine, but I'd match other keywords. So if you're using pub and priv instead of public and private, I'd use ret instead of return as well.
Also, did you consider pythonic 'and' and 'or' keywords? Typing 'or' requires fewer keystrokes than || (and 'and' requires no more than &&). Plus, neither requires any shifting! I know Rust developers are lazy typists. ;)
Then again, the "C familiarity" rationale would seem to contradict the choice of `match` over `switch`, though I think pattern-matching is a sufficiently big deal to warrant a distinct keyword. It's an interesting comparison to Rust's old `tag` keyword, which was finally changed to `enum` because the easiest way to explain it was "look, they're basically C enums, but better". Personally I think the keyword should have remained `tag`, but you can't win 'em all. :)
I don't think ret vs return is big deal. Both are understandable and relatively short, or expected. On the contrary, odd unknown, new syntax may sometimes be.
Good job on the new release :)
With editor's code completion, it's really no big deal with the extra 3 chars. Alt-/ does the magic in Emacs.
Also people who really don't like the typing can use the implicit return expression.