3 ms·
There are many good ideas that aren't in one programming language or another. Does that actually mean they are bad ideas? No. It only means that particular l
by b2gills 6y ago
There are many good ideas that aren't in one programming language or another.
Does that actually mean they are bad ideas? No.
It only means that particular language didn't copy that particular idea.
There may be bad ideas that are in many languages, that doesn't somehow make them good.
---
Quote-words are used regularly in Perl because they are clear and useful.
for (qw' alpha beta charlie ') {
say
}
for (split '', 'alpha beta charlie') {
say
}
for ( 'alpha', 'beta', 'charlie' ) {
say
}
The `qw` emphasizes that we are dealing with `alpha`, `beta`, and 'charlie`. The other ones have extra noise that is only there to satisfy the compiler.
Now imagine you have to add `delta` to the list.
With the `qw` you only have to press the spacebar and the letters `d e l t a`. You don't have to worry if you accidently left off a `'`, because you didn't need to add one.
To be fair, the `split` would have the same benefit. But it is still more error-prone. For example I wonder how many people didn't notice that the first argument to `split` was an empty string when it should have been a string with one space in it.
I didn't even notice it, and I've been programming in Perl for decades.