My opinion, and I think the general opinion in many other languages, is that being a bit more descriptive can make the code more readable and self-documenting.
In your example, instead of using
s for any string, why not use a name that describes what the string is? Such as
column_title. Instead of
t for time, use e.g.
arrival_time. Instead of
beam_height, etc. (And please never use
l as a variable name, since it’s so easily confused with the digit
As for masking existing names, I would argue that
sum is perhaps not a “meaningful / long name”. I might wonder: Sum of what? With a more descriptive name like
distance_sum, there would be no conflicts.
With that said, I think short or single letter variables are acceptable in several circumstances. Mainly when the context is so small that there’s no room for confusion. For example in anonymous functions like this:
sort(rand(1:100, 10); by = n -> n % 10)
Another situation is functions where the argument has no real meaning by itself, like
Also, if the code consists of dense formulas with repeated use of variables, it might make the code more readable to shorten the names (in this case,
h might be preferred over longer names).