On May 23, 2011, at 11:51 AM, Bob Nystrom wrote: > The Javascript committee is spending a huge amount of effort right now to > improve JS's function syntax moving forward in part because "function" is > long.
Everyone's entitled to their opinion; I respectfully disagree. > > <puts on English nerd hat> "fn" is still a word. > Err, not to be snarky, but a random checking of online dictionaries list the only English meaning of "fn" as "footnote". (But yeah, the meaning in this context is unlikely to be unclear.) > 1. Any user will need to know them anyway, so it's not like they need to be > explicitly read and comprehended at each site where they appear. From that > angle, any token is as good as any other. Sure, but that's not a useful angle; the point is to use tokens that express the meaning of the code to both human and compiler. So, yeah, you could also use "foo" for this keyword, and people would learn to parse it well enough, but it would be more jarring to read than actually necessary. (Sorta like requiring that Shakespeare always be typeset in Comic Sans....) > 2. Using an abbreviation leaves the full word available as an identifier. Now > you can have a variable named "function" in your code. > I don't think I've ever had the desire to do this in 20+ years of programming. (And conversely, it means I *can't* have a variable named "fn" in my code.) > > Most established languages do use abbreviations: int, const, float, bool, > extern, enum, typedef, etc. Go chose "func" for function. This is true, and I very much doubt I'd ask for "integer" over "int", so I freely admit this is an arbitrary argument on my part. At any rate, I'm a non-contributing lurker on this list, so my vote counts for very little; but since a little syntax bikeshedding came up, I thought I'd chime in as a dissenting opinion from the Slightly-More-Verbose-Is-Good camp... _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
