[rust-dev] Questions from a newcomer

Abraham Egnor abe.egnor at gmail.com
Sun Jan 12 05:16:33 PST 2014

Oh yes, and one more:

* Why does the do-notation require a function that takes a proc()?  Given
that || is the recommended type for HOFs it seems like it would be much
more convenient if it worked with functions expecting a proc() or a ||.

On Sun, Jan 12, 2014 at 8:09 AM, Abraham Egnor <abe.egnor at gmail.com> wrote:

> Hello!  The 0.9 release prompted me to poke at my nascent rust code.  Very
> impressed with the language and the progress since I last looked (0.4
> maybe?).
> Some questions that I wasn't able to find answers for:
> * Is there any built-in way to iterate over all values of a C-like enum?
>  It's not hard to define an iterator method that implements this for any
> given type, but it's tedious boilerplate that seems better left to the
> compiler.
> * Is it possible to express "if a type implements trait A, here is a
> default implementation of trait B"?  I tried the obvious way ("impl<T:
> TraitA> TraitB for T"), but it looks like the rust compiler can't
> disambiguate between that impl and type-specific impls.
> Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140112/867eee7e/attachment.html>

More information about the Rust-dev mailing list