Skip to content
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

A "Design FAQ" document #891

Closed
steveklabnik opened this issue Feb 20, 2015 · 23 comments
Closed

A "Design FAQ" document #891

steveklabnik opened this issue Feb 20, 2015 · 23 comments

Comments

@steveklabnik
Copy link
Member

Issue by bstrie
Tuesday Nov 27, 2012 at 20:34 GMT

For earlier discussion, see rust-lang/rust#4047

This issue was labelled with: A-docs, I-wishlist in the Rust repository


In the vein of the Project FAQ and the Language FAQ.

In addition to being really interesting, this would save a lot of time and divert a lot of potential questions in the long run. Some topics to discuss:

  • Why was typestate removed?
  • Why are some types nominal instead of structural?
  • Why do I have to declare impls in the same crate as a type or trait?
  • Why is trait inheritance the only means of inheritance?
  • Why doesn't Rust do tail-call optimization?
    (see e.g. rust-dev post.)

Explanations should be technical and include code examples wherever possible.

Some of the questions of this nature overlap with the latter half of the Language FAQ, but not all, e.g. "Can Rust code call C code?" and "What is the difference between a managed pointer and an owned pointer?" do not belong. The document should focus on large-scale design decisions and tradeoffs; think "Why split stacks?" rather than "How do split stacks work?".

If you think of good questions, add them in the comments here. There are probably a lot of ripe areas for explanation, especially with regard to mutability and regions.

@steveklabnik
Copy link
Member Author

Comment by brson
Tuesday Nov 27, 2012 at 21:24 GMT


The manual has a related (and empty) section: http://dl.rust-lang.org/doc/0.4/rust.html#appendix-rationales-and-design-tradeoffs

@steveklabnik
Copy link
Member Author

Comment by bstrie
Thursday Nov 29, 2012 at 18:53 GMT


Why are &str, @str, ~str, &[], @[], and ~[] treated differently from &T, @T, and ~T?

@steveklabnik
Copy link
Member Author

Comment by bstrie
Wednesday Dec 05, 2012 at 15:56 GMT


Why are early returns disallowed within closures?

@steveklabnik
Copy link
Member Author

Comment by bstrie
Friday Dec 07, 2012 at 18:19 GMT


Why are separate do and for constructs required?

@steveklabnik
Copy link
Member Author

Comment by bstrie
Tuesday Dec 11, 2012 at 12:45 GMT


Why do traits in Rust depart from the design in the original traits paper?

@steveklabnik
Copy link
Member Author

Comment by bstrie
Tuesday Jan 01, 2013 at 18:07 GMT


Why must imports be qualified relative to the crate?

@steveklabnik
Copy link
Member Author

Comment by graydon
Wednesday Jan 02, 2013 at 03:38 GMT


These are great, please keep them coming

@steveklabnik
Copy link
Member Author

Comment by catamorphism
Wednesday Jan 02, 2013 at 21:59 GMT


"What does const mean (and why)?" should be in there too, though I know we're thinking about renaming it (at least).

@steveklabnik
Copy link
Member Author

Comment by bstrie
Thursday Jan 17, 2013 at 13:47 GMT


Why feature conditions rather than exceptions?

@steveklabnik
Copy link
Member Author

Comment by jruderman
Tuesday Jan 29, 2013 at 22:50 GMT


Why so many pointer types? Why not rely on escape analysis instead?

Answered at:

http://www.reddit.com/r/programming/comments/17hqg4/a_little_bit_rusty_practical_approach_on_rust/c85r1nc

@steveklabnik
Copy link
Member Author

Comment by bstrie
Thursday Jan 31, 2013 at 13:26 GMT


Why is the .times() method no longer defined on signed integers? (discussion on the specifics of integer literal inference)

@steveklabnik
Copy link
Member Author

Comment by bstrie
Thursday Feb 21, 2013 at 15:06 GMT


Why do borrow checks on @mut pointers happen at runtime?

@steveklabnik
Copy link
Member Author

Comment by fread2281
Sunday Mar 24, 2013 at 21:40 GMT


Why are there no exceptions?

@steveklabnik
Copy link
Member Author

Comment by bstrie
Tuesday Apr 02, 2013 at 19:12 GMT


Why is name resolution such an intractably hard problem?

<@pcwalton> I know of no other static language with declarative imports
            that allows (a) reexports; (b) glob import; (c) mutual
            recursion everywhere; (d) nested modules; (e) two namespaces
<@pcwalton> java doesn't have reexports, Go doesn't have nested modules
            or reexports, C# doesn't have reexports I don't think, C++
            doesn't have reexports or mutual recursion everywhere, maybe
            D...
<@pcwalton> ML and Haskell don't have mutual recursion everywhere and
            don't have reexports
<@pcwalton> mutually recursive modules too
<@pcwalton> most languages do not have mutually recursive modules
< bstrie> pcwalton: so what you're saying is that rust has once again
          failed to be unoriginal :)
<@pcwalton> well, as you said, Python
<@pcwalton> but Rust is trying to achieve Python's module system's
            expressive power in a static system
  jld tries to remember how the various Scheme module systems work
<@pcwalton> turns out that's pretty hard :)
<@pcwalton> jld: no mutual recursion
<@pcwalton> btw, ES6 hit the exact same problems we did
<@pcwalton> and had to pare down their module system as a result
<@pcwalton> anyway none of this is an excuse, we should make it easier to
            use
<@pcwalton> but I'm just saying it's not that easy...

@steveklabnik
Copy link
Member Author

Comment by brson
Tuesday Apr 30, 2013 at 22:04 GMT


Here's a summary about dynamically sized types https://mail.mozilla.org/pipermail/rust-dev/2013-April/003933.html

@steveklabnik
Copy link
Member Author

Comment by brson
Tuesday Apr 30, 2013 at 22:39 GMT


Summary of 'why no exceptions' https://mail.mozilla.org/pipermail/rust-dev/2013-April/003815.html

@steveklabnik
Copy link
Member Author

Comment by catamorphism
Tuesday Apr 30, 2013 at 22:43 GMT


Summary of 'why no purity-in-the-type-system, i.e., why no effect system': https://mail.mozilla.org/pipermail/rust-dev/2013-April/003926.html

@steveklabnik
Copy link
Member Author

Comment by iampiyush
Thursday Jun 13, 2013 at 13:57 GMT


document how to make non-utf8 byte vectors with bytes!(…)

e.g.
use of bytes!("hell", 0xc0, 0xca, "o!") instead of bytes!("hell\xc0\xca\o1!")

@steveklabnik
Copy link
Member Author

Comment by brson
Tuesday Jul 30, 2013 at 16:39 GMT


-> in function syntax: https://mail.mozilla.org/pipermail/rust-dev/2013-July/005042.html

@steveklabnik
Copy link
Member Author

Comment by kud1ing
Monday Aug 05, 2013 at 10:06 GMT


Why have we mostly moved from internal iterators to external iterators?
https://mail.mozilla.org/pipermail/rust-dev/2013-June/004364.html

@steveklabnik
Copy link
Member Author

Comment by kud1ing
Thursday Aug 08, 2013 at 07:23 GMT


Why was the runtime ported from C++ to Rust?

@steveklabnik
Copy link
Member Author

Comment by brson
Wednesday Dec 04, 2013 at 20:11 GMT


Why is rustc slow? https://mail.mozilla.org/pipermail/rust-dev/2013-November/006975.html

@steveklabnik
Copy link
Member Author

Import rate limiting made this fail :( re-opening the original: #615

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant