4 ms·
First, it is pretty funny for this poster to use this as a reason why perl is a well thought out language. It like all languages has pros and cons, and picking
by birken 15y ago
First, it is pretty funny for this poster to use this as a reason why perl is a well thought out language. It like all languages has pros and cons, and picking one thing about perl that isn't even unique to perl isn't a good example of how perl is so well thought out.
Second, I agree with the premise that having two separate structures is better, but a lot of the issues brought up in this post just don't come up in the real world. For example with PHP once you understand that the array() construct is just a hash map with a linked list that stores the ordering, a lot of the these complications are much less complicated. Just don't think of the keys as indexes in an array, think of them as keys in a hash map that have nothing to do with ordering. If you want to change the order, you need to change the linked list, which initially is set by insert order but can be changed to something else by using various sort functions. Again, I'm not saying this is the greatest design in the world, but I am saying that living with this design in practical application isn't a big deal.
In fact, the biggest annoyance has nothing to do with any coding stuff, it is just that you pay a huge memory penalty if you just want a simple array of items. Luckily PHP added a few newer data structures (http://www.php.net/manual/en/spl.datastructures.php http://www.php.net/manual/en/spl.datastructures.php) like SplFixedArray which are much more memory efficient. Obviously in standard usage the memory doesn't really matter, but in some cases where you want very large data structures these new objects come in handy.
- SwellJoe 15y agoIt like all languages has pros and cons, and picking one thing about perl that isn't even unique to perl isn't a good example of how perl is so well thought out. I believe you've misread the intent of the title. I read it as an answer to the question: "Why does Perl have arrays and hashes, even though the language I'm used to does not?" And, this article takes a decent stab at explaining why Perl has arrays and hashes. It does not, as far as I can tell, make any attempt to explain why this proves that Perl is superior to all other languages or is more thought-out than other languages (except perhaps those languages that don't have separate array and hash datatypes). The way I read it, it's saying in a lot more words, "You'll like it once you get used to it."