6 ms·
Please Rust-lang, why, oh why, do you choose to name function 'fn' and module 'mod', dont you expect to read any of the programs you write!? How is anyone supp
by antocv 12y ago
Please Rust-lang, why, oh why, do you choose to name function 'fn' and module 'mod', dont you expect to read any of the programs you write!?
How is anyone supposed to read fn main(). Fun main? Fen main? F of N? Is it related to ln in println?
Ive tried rust, but it just doesnt parse well in my mind. More time is spent for me parseing out the bullshit terse keywords than the meaning of the program.
Ada gets this right, there you have to write exactly what you mean, end begin, if then. Simple clear.
Terseness, shorts and abbrevations, thts now hw you wrt anyng.
- Vanzetti 12y agoYou are not supposed to read programs aloud. What do you think it is, poetry? 'fn' is a symbol.
- antocv 12y agoWell yeah, it should be poetry. Instead of, what, cryptic symbols to decipher? You dont read symbols?
- Vanzetti 12y agoI know that 'fn' defines a function. It could be 'def', 'funct' or 'Ξ', it doesn't really matter. Also, what's the problem with pronouncing 'fn' as 'ef-en'?
- bsdshepherd 12y ago> It could be ... Ξ Thank you. Somewhere, a transliteration vim plugin is struggling to escape. Based on user preferences it will display: def Σ(): print("LOL WUT?") Σ() -or- define sum(): print("LOL WUT?") sum() -or- Ξ Σ ⍋("LOL WUT?") Σ -or even- IDENTIFICATION DIVISION. PROGRAM-ID. Abomination. PROCEDURE DIVISION. DisplaySummary. DISPLAY "LOL WUT". STOP RUN.
- antocv 12y agoYes, exactly, we can make translations of symbols so that it is actually easier for human readers to decode the meaning and message of the symbols. Perhaps we could even reuse previous symbols and meanings to convey what we want to convey instead of offering ambiguity. I just wonder, who would have thought of such an idea. That is genious. And something that has completely evaded Rust designers.
- bsdshepherd 12y ago> Perhaps we could even reuse previous symbols You do. The symbol is given meaning by context. > who would have thought of such an idea. That would be me. > genius Weed, caffeine, and sleep deprivation. Staring at Harris mainframe assembly language core dumps on reams of green bar paper... does things to a man. ;-) HTML5 and Unicode are wonderful toys. Go play. My notes and early efforts on this go back to 1979. Anyone is welcome to them. It does take quite a bit of effort to transmit, so patience is a virtue here. (P.S. Don't overlook color.) (P.P.S. Or animation.) --- Edit: You'd be surprised how easy input becomes. It removes a huge mental load from context switching (e.g. hitting the same button to get Control F4, Control W, Apple W, Alt F Alt C, etc.). Use a few touchpads which can change the symbols based on current context, and baby - you got a stew goin'. Take care.
- joshmarinacci 12y agoWait. Who are you? I'd love to see you notes on this stuff from the 70s and 80s.
- joshmarinacci 12y agoI've been working on similar stuff here: http://joshondesign.com/2014/08/22/typopl http://joshondesign.com/2014/08/22/typopl
- bsdshepherd 12y ago> And something that has completely evaded Rust designers. “If you've been playing poker for half an hour and you still don't know who the patsy is, you're the patsy.” - Warren J. "Doc" Gates Programmers are the patsy that businesses and universities use to keep growing ever larger heads of broccoli that consumers eat. Note the similarities between GUI's 30 years ago and today: http://en.wikipedia.org/wiki/History_of_the_graphical_user_interface http://en.wikipedia.org/wiki/History_of_the_graphical_user_i.... Try to wrap your head around how many API's, tools, training materials, releases, updates and so forth have been done in thirty years which are effectively redundant. The iWatch will contain regurgitations of the same todo lists, logging, sticky notes, etc. as the Palm Pilot, but without AAA batteries.
- mercurial 12y agoYou should try Haskell for size before complaining about Rust. IMHO, it's really a matter of taste, and something which most people get over with quickly if they find it an issue. Actual semantics are much more important than a small number of language keywords. Libraries, on the other hand, should definitely use easy-to-understand symbols.
- reirob 12y agoI feel exactly the same way. Thanks for saying it loud!
- simias 12y agoCome on, that's a complete bikeshed and I'm sure you know it. If you have to read code aloud you can just say "fun" or "function" and "mod" or "module", obviously. And since those symbols are used everywhere in the source code I really doubt anybody is going to forget what they mean. I know it's trendy to remove all non alnum characters and make everything super verbose but there's a compromise to make here. Because some languages went overboard with symbol soup doesn't mean all symbols/abbreviations are bad. This is the kind of reacting any newcomer to a language makes. You start with lisp? "omg all those parens!" You start with python? "omg significant whitespace!" You start with C? "OMG all those semicolon at the end of lines!" You start with perl? "OMG!" You start with APL? "O|▼". Also I think making basic language constructs overly verbose doesn't help legibility because it drowns the actually interesting bits in a lot of boilerplate. VHDL comes to mind, but it's probably not what you were talking about...
- antocv 12y agoI dont read code aloud, but when reading it I have to make the sounds in my head. Makes sense? fn calculate() does not lead my brain/mind to discover everything there is it already knows that is function and what it means in this specific context, but instead if I read it as fun it takes me to fun times calculating tip at college with friends. mod means modification. Modulus. Or module. Why oh why, cant they just write freaking word module?! Thats what programming is about - kill assumptions, define stuff, and Rust is flowing with assumptions and tersness. Ada is what I am talking about - a very fine verbose language. Even Java is better than rust. I think if Mozilla designed Java, it would look like this pub cls Dfne { priv stat fin Str hey; }
- Shamanmuni 12y agoYou better get over that problem because, depending on the language and context, you will find function written as fn, func, def, ->, lambda and many more. Some languages even don't offer a keyword for it. In Rust, the function keyword is written 'fn', there're no assumptions or ambiguity there. You just have to learn "in Rust fn means function". It's as capricious as any other keyword, including function. As a non-native English speaker I find this amusing because for me it's very clear that keywords are magic incantations for the compiler or interpreter, they aren't meant to explain anything. You just learn how to use those keywords and deal with it. For me, it's not clearer to write function instead of fn because in my native language you write it 'función'. In my experience, it's not rare for Spanish-speaking programmers to ommit the t in function as it is the clearest and most natural way for them to write it. Then, when the program doesn't work, they have to add the missing ts. I feel fn is an improvement with regards to this, as it's not so English-centered. Let's stop pretending that programming a computer is a mixture of Logic, Math and English.
- gosub 12y agodo you think that python should use "define" instead of "def"?
- antocv 12y agoYes, I think thats a miss python made. But python at least doesnt have the goal it seems to make abbrevations and allow misconceptions about what the language is saying.
- hippiehippo 12y agoOn the other hand, do you think that python should use "df" instead of "def"?
- ben0x539 12y agoMaybe they could use fn? :)
- jacquesm 12y agoThe use of fn in programming languages to denote 'function' goes back to the 60's. Even BASIC had it! (deffn).
- stock_toaster 12y ago> How is anyone supposed to read fn main() I humorously read it in my head as "fuckin' main".
- easytiger 12y agofn & mod are fine. no worse than cdr & car. Variable declaration and type annotations in rust are the thing you should be confused/angry/sad about.
- bcj 12y agoI would say fn and mod are a lot better than cdr and car. At least fn and mod are just abbreviations of the words they represent. cdr and car requires me to know 60-year-old implementation details of Lisp.
- kyllo 12y agoThis is why I like 'head'/'hd' and 'tail'/'tl' from ML/Haskell family more than Lisp/Scheme family's car/cdr.
- mercurial 12y agoWhat do you find wrong about variable declaration and type annotation? Most variable declarations are like 'let foo = ' with the type auto-inferred. I admit that the diamond notation for type parameters is a bit aggravating, but it's not the end of the world. On the other hand, the little rust I've seen had a large number of as_slice() calls...
- easytiger 12y agoUltimately I need to spend some more time with it. I'm sure it's fine, I just find it jarring. One major issues is the official tutorial doesn't explain all possible variances of syntax for declaration in one place so my brain wasn't given a chance to compare them side by side. Also i'd much rather live without type inference, so I guess rust gives me that option. I'm just too neurotic (low level networking code/parsers/etc) to not specify types. let mut monster_size: int = 50; I'd really really just like the type to be first. let mut int monster_size = 50; But wait, there are yet more options: let monster_size = 50i32; Boxes are just plain confusing on first sight. They make pointers look like a lucid breath of fresh air. let owned = box 10i; let borrowed = &20i; let sum = *owned + *borrowed; I find options in a language quite distressing (see also perl). I'm also not sold on the mut keyword and i'm likely to become confused when one gets to complex types. Don't get me started on the automatic dereferencing. That's seriously confusing. Is there a rule of thumb for when I am meant to use which of these? can i use the type annotation anywhere i use a number as a literal? Raw string literals: > They are written as r##"blah"##, with a matching number of zero or more # before the opening and after the closing quote Why? Why the optional number of #'s? Syntax extensions? ! Why is print a syntax extension? why isn't it in the library? if it is a macro why are we running around putting ! at the end of them... why does it matter? Why do that? I prob don't know what I'm talking about but that's my initial impression from last week
- Grue3 12y agoAbsolutely agreed. Programs are for reading. For a language designed in 2010s there's no excuse to use such ridiculous abbreviations.
- general_failure 12y agoNot sure why you are getting downvoted. I find it very annoying as well. Why not use brk, cont as well? Somethings are abbreviated, some things are not.
- deleted 12y ago[deleted]
- kansface 12y agoBoth your comment and OPs comment have no place. The article itself is a newly published guide to Rust. OPs comment derailed the entire thread- perhaps 2/3 of the discussion is in response. Ideally, if this comment merited discussion, it would be submitted as its own thread (where it would quickly go nowhere). After all, the assertion, fn is a stupid name, is a bikeshed- a triviality offering a safe opinion for everyone. Rust isn't going to change the token. Please refrain from bikeshedding in the future.
- spyder 12y agoMaybe you shouldn't spell out every abbreviation (and acronym) when you read? Otherwise it can be "fun" when you read HN comments about the HTML5 WebGL API and the low FPS CSS animations that eats too much CPU power.