On 01/07/2014 02:46 AM, Jeff Walden wrote:
I'm writing this list, so obviously I'm choosing what I think is on it. But I
think there's rough consensus on most of these among JS hackers.
JS widely uses 99ch line lengths (allows a line-wrap character in 100ch
terminals). Given C++ symbol names, especially with templates, get pretty
long, it's a huge loss to revert to 80ch because of how much has to wrap. Is
there a reason Mozilla couldn't increase to 99 or 100? Viewability
on-screen seems pretty weak in this era of generally large screens.
Printability's a better argument, but it's unclear to me files are printed
often enough for this to matter. I do it one or two times a year, myself,
these days.
99 or 100 for line lengths sounds good to me. Use of templates has increased
quite significantly and 80ch isn't enough anymore.
I don't think most JS hackers care for abuse of Hungarian notation for
scope-based (or const) naming. Every member/argument having a capital
letter in it surely makes typing slower. And extra noise in every name but
locals seems worse for new-contributor readability.
It is rather common to have prefixed variables names (outside Gecko), and it
increases readability of the code in many cases.
For example with out params it helps significantly when you know which thing is
actually the return value.
Also with long functions prefixes help to locate the variable definition.
Personally this
doesn't bother me much (although "aCx" will always be painful compared to "cx"
as two no-cap letters, I'm sure), but others are much more
bothered.
JS people have long worked without bracing single-liners. With any style
guide's indentation requirements, they're a visually redundant waste of
space. Any style checker that checks both indentation and bracing (of course
we'll have one, right?), will warn twice for the error single-line
bracing prevents. I think most of us would discount the value of being able to
add more to a single-line block without changing the condition
line. So I'm pretty sure we're all dim on this one.
I'd say consistency is good in this case. always {}. No special cases. And it
improves readability, since {} forces the almost-empty line
after the single-liner.
Skimming the rest of the current list, I don't see anything that would
obviously, definitely, be on the short list of complaints for SpiderMonkey
hackers. Other SpiderMonkey hackers should feel free to point out anything
else they see, that I might have missed.
Jeff
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform