Am 20.12.2011 um 19:16 schrieb Niko Matsakis:
> Hi,
>
> In preparation for the 0.1 release, Brian and I were thinking it might be
> nice to try to address small, annoying problems that come up in everyday Rust
> programming. Of course, a lot of these are already the result of compromises
> over contentious issues (e.g., trailing dot for nullary tag in a pattern),
> but I'd still like to know what the set of annoying things are; some of them
> may be easier to resolve now. Can you please e-mail me your favorite pet
> peeve(s). Thanks.
>
Hi, great idea!
First, hello on the mailing list, most of you probably have already seen me on
irc.
So here's my list of scratches, surely not all of them are for 0.1:
1. I support being able to drop mandatory literal type specifiers on values
that are within the range of their expected type
Related: I'd like contributed source highlighting code for vim, emacs etc.
to highlight all literal type specifiers
(very long f32, f64 literal constants can be difficult to read otherwise,
e.g. -XXXX.YYYYe-Zf32)
2. Some kind of match or fail or default statement/library utility function as
suggested by elly would be nice.
Would be volunteering to do it.
Possible idea in this direction
let pat = expr1 or expr2 or ... or { fail|ret|default value that statically
is known to match pat }
First match wins.
This is like an inverse of alt: instead of matching the same experession
against different patterns
this matches different expressions against the same pattern
3. Some way to deal with nullary tags in patterns.
The problem for a good syntax seems to be that we want to write patterns in
the same way as regular code as much as possible.
I feel for consistency it may be the better road to mark variables somehow,
as pattern variables are actually a bit
of a different construct than regular variables.
Alternatively, the established "constr." syntax should just do fine.
4. Lack of break, continue, and labels. I know this is a big one but some
loops are difficult to write without. Anything
more than what is there today will be much apreciated.
I hit this when writing bench/sudoku.rs which is a port from some Java code
of mine. Any code conversion to rust may
suffer from lack of these features (same holds for C style for loops). Also
common in numeric code.
5. import/export
- support for (at least trivial) type casting, i.e.
import XY as TYP, export XY as TYP
Rationale: Would help me drop a lot of wrapper functions in core::float
and seems clearer to me than
the wrappers that are in place now. Haven't looked into how hard it would
be to do this.
- syntax for exporting all or no constructor(s) of a tag, perhaps using a
special export clause "export* tag")
6. Support for consts refering to other consts from the same crate (again, for
math).
7. Some form of tail calls, please :)
I'v written up an idea around this in the wiki, please feel free to edit
there.
8. a bit more documentation in the compiler on how things are supposed to work,
especially the central data structures
could use a few comments
So much for now,
Greetings,
Stefan
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev