News for hackers. Stuff that matters.
Re:Things People Eventually Learn About JavaScript Projects by jetrink on Monday August 20, 2018 @03:35PM (#17803143)
The Clojure world has a set single-letter naming conventions that, since they are widely accepted, greatly improve readability. If you see an argument named `f`, you can be sure it is a function. `m` is a map, while `k` and `v` are used for keys and values, respectively. `x` and `y` are numbers and `n` is always an integer.
Re:Things People Eventually Learn About JavaScript Projects by nine_k on Monday August 20, 2018 @04:10PM (#17803480)
I bet the scope of such names is pretty narrow, no more than 3-4 lines? The narrower the scope, the less descriptive your names may be, and such math-like conventions make sense.

In a 50-line function (which you should avoid but sometimes can't because of long lines wrapped for readability), using a name like `f` throughout is a harder sell.

Re:Things People Eventually Learn About JavaScript Projects by FlipperBucket on Monday August 20, 2018 @03:52PM (#17803306)
I prefer a convention of semantically relevant variable names prefixed/suffixed by a letter indicating type.
Re:Things People Eventually Learn About JavaScript Projects by Sharlin on Monday August 20, 2018 @03:59PM (#17803375)
Didn't we already collectively decide that Hungarian notation is a bad idea? About 20 years ago?
Re:Things People Eventually Learn About JavaScript Projects by FlipperBucket on Monday August 20, 2018 @06:57PM (#17804862)
No. It's alive and particularly pragmatic in dynamic languages. The type of sigil, @ or $ or I or Array(space) are all equal to the interpreter. The difference is how offended you might be that type annotations are semantically identical.
Re:Things People Eventually Learn About JavaScript Projects by jetrink on Monday August 20, 2018 @04:02PM (#17803394)
To be clear, the above examples are used when the function is designed to accept any such argument and only relevant info is the type.