4 ms·
My kingdom for a TL;DR! (As a prerequisite to making its point, the article teaches many intricate details regarding two dynamic languages which even most of t
by Scramblejams 14y ago
My kingdom for a TL;DR!
(As a prerequisite to making its point, the article teaches many intricate details regarding two dynamic languages which even most of their practitioners probably never think about, then dives into more intricate details regarding a language which most of us have probably never even used, let along grokked all the details of. I sense that there's something important here for me to learn, but from where I sit this article is a lot to bite off all at once.)
A tight summary by someone who understands all this would be appreciated by many readers, not just myself.
- irahul 14y ago> A tight summary by someone who understands all this would be appreciated by many readers, not just myself. A tight summary of all of it would be as long as the article. However, the point about semicolons in Rust is: 1. ; is a separator, not a terminator. 2. a;b separates a and b. 3. a; is a special case which means a;nil(or whatever is the equivalent in Rust) 4. The last expression in a function will be the return value of the function. 5. If the last line in a function is "a", it returns a. If it's "a;", it returns nil(from 3)
- Scramblejams 14y agoPerfect, thank you.
- cmccabe 14y agoI don't think parent deserves to be modded down. The article did take a pretty long time to get to the point. Why all this talk about Python and Ruby? Rust is not really competing with those languages-- it is quite specifically designed as a C++ replacement. They should be comparing themselves against C++, Golang, or D. The Golang solution would just be a function which returns the next element or nil if there are no more elements. That function might be part of an interface, if you wanted to generalize it across several types. To me, this is a lot simpler than the other stuff that was discussed. To go back to Rust specifically, rather than having magic semicolons, why not make the "break" statement take a value, which becomes the return value of the block? Despite all the tl;dr there was not much discussion of design alternatives.