Comments (3)
Hey all! Thank you both for looking into this.
Indeed, the text mentions BTreeMap<K, V>
and the focus is on why Ord
alone doesn't quite get us everything we'd want. So these snippets omit the K
and V
for brevity.
However, I agree the suggested change would be an improvement! Having both the current text and impl<K, V> BTreeMap<K, V> { ... }
code blocks is likely the most clear: Q
stands out more as being introduced by fn get<Q>
and missing from the impl<K, V>
scope (as pointed out). And in this paragraph we're still talking about BTreeMap
, haven't gotten to scapegoat trees yet!
I read this really great blog post once about writing technical books. Can't find the original link (will share if I find it later) but the advice was something like "always go for clear over clever, if it's not clear then it can't be clever". Here omitting K
and V
is "clever" but makes things less "clear". 😉
How about making the suggested change to the first 2 code blocks containing fn get
in this section? Would you like to PR this update?
IMO the last block containing fn get
, which adds Default
to the signature, is safe to leave as is because by that point the reader will be aware of the surrounding impl
- having seen it twice before.
from high-assurance-rust.
While I like including explicit information,
This information is already stated a line previously.
Based on the above, you might expect the get method's signature to look like this for BTreeMap<K, V>:
furthermore, it distracts from the objective of the article.
I would like to mention that this article isn't a tutorial for building a BTreeMap
(otherwise, direct copy and paste would be desirable), but rather an explanation of why BTreeMap
uses more than just Ord
as a constraint.
from high-assurance-rust.
Hey, sorry for the super late reply. I will look into creating a PR for this today!
from high-assurance-rust.
Related Issues (16)
- `TreadSanitizer` typo in Chapter 3.1 footnote 12 HOT 2
- Chapter 2 Dynamic Assurance lib.rs path HOT 3
- PDF Version HOT 2
- Chapter 1.5 namespaces reference link. HOT 3
- Incorrect wording in chapter 1.1 "Languages by Level" HOT 2
- dead? HOT 2
- v0.3.1
- Error in stack frame diagram? HOT 2
- Chapter 4.3. - Calling `strlen` on NULL HOT 1
- E: Unable to locate package rr HOT 6
- Printing to pdf has formatting issues HOT 1
- Translations?
- "Heartbleed" misspelled as "Heart Bleed" HOT 2
- Add "Community Contributors" list to "About the Team" and a `CONTRIBUTING.md` to this repo
- Correct misspelling of some vulnerabilities (Heart Bleed -> Heartbleed, Eternal Blue -> EternalBlue) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from high-assurance-rust.