11 ms·
I don't know anything about ruby but that seems extremely error prone to me. EDIT: I think I know why I think it's error prone: In all programming languages b
by simias 13y ago
I don't know anything about ruby but that seems extremely error prone to me.
EDIT: I think I know why I think it's error prone:
In all programming languages besides the core syntax of the language idioms appear among the community of coders. For instance, in C you travel through an array using something like:
for (i = 0; i < n; i++)
a[i] = ...;
Where n is the length of the array. This is an idiom so common that if for some reason in some code the length of an array is (n + 1), instead of writing for (i = 0; i <= n; i++) I'll write for (i = 0; i < (n + 1); i++).
Because the idiom is so strongly entrenched in my brain (and probably many other C coders) if I read the <= version there's a great chance I'll read it as a "<" and assume i goes from 0 to n - 1.
My point is adding several alternative "syntactic sugar" to express the same thing can end up confusing newbies because they'll have to learn the difference between all version (and recognize them) as well as experienced coders because you're more likely to mistake the meaning of an expression at a cursory glance.