-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some useful interfaces to the core and std libs #1439
Comments
Would it be possible to do this re-exporting in libcore/core.rs? |
I think I'd rather not put a bunch of non-optional interfaces in every scope. |
Fair enough. I don't find it easy to map Haskell concepts to Rust all the time. May i suggest that we consider that the interfaces are adjectives where possible? |
Adjectives? Don't nouns (seq) or verbs (show) make more sense? Can you give some examples? |
Haskell is using adjectives for newer type classes, e.g. "IsString", "Foldable", "Traversable", "Typeable", "Storable" I think TypeState predicates in Rust are mostly adjectives like "is_not_empty" etc. My suggestion would be:
It's certainly a matter of taste:
which to me would be as nice as
Why do nouns make more sense in your opinion? |
I'd reserve adjectives for predicates and find some other naming scheme for interfaces. In any case, please do not use "is_", we just agreed to use that for predicates. I like marijns suggestion to try and use verbs for interfaces ("t: shows, t: iterates") |
I agree interfaces are at least as likely verb-y as noun-y. But the -able and even -s suffixes seem noisy. The syntactic context makes it quite clear we're talking about an interface.
looks ok to me. |
I'm fine with verbs. I've update the yet sketchy Core styleguide |
Was |
No! I got the bug number wrong. |
|
* fix incorrect #[note] syntax * more syntax fixes * add missing lifetime
* fix incorrect #[note] syntax * more syntax fixes * add missing lifetime
To find out whether they work well, we should try to actually use them.
to_str
andseq
are some obvious candidates.If #1438 is resolved, we can provide a
core::impl::common
module that exports impls for common interfaces of built-in types, so you'd only need a singleimport impl::common::*
to get access to[1].len()
and10.to_str()
.The text was updated successfully, but these errors were encountered: