3 ms·
Here's a picture of the AWK book next to the Camel book https://twitter.com/heinrichhartman/status/771706433452769280 https://twitter.com/heinrichhartman/status
by dannas 8y ago
Here's a picture of the AWK book next to the Camel book https://twitter.com/heinrichhartman/status/771706433452769280 https://twitter.com/heinrichhartman/status/77170643345276928...
"#awk doc shows you how to implement a rel-DB and a compiler. #perl doc talks 20p+ about nested data structures."
- FractalLP 8y agoThat is one thing I like better in Python than in Perl. In Perl, I was having difficulty with nested data structures and then realized this was something I did in Python daily without even knowing it was a thing on a conscious level. Who hasn't made some weird dictionary with its values being lists or tuples or something like that?
- ajross 8y agoThis is exactly backwards to my eyes. Perl's autovivification behavior (assigning through a empty reference to something autocreates the object of the right type) makes nested data much, much cleaner. Who hasn't made some weird dictionary with its values being lists and forgotten to check for and write code to create it when it doesn't exist, and had to fix that later after a runtime crash? In perl that's literally covered by the one-line assignment you used to set the field you parsed. This is why it's sad that everyone's forgotten perl.
- FractalLP 8y agoSorry, but I didn't catch your example. Can you explain a little more? What does Perl do better there?
- kqr 8y agoDefaultdicts to the rescue! But I think it should be an explicit choice. If you only intend to have lists at some keys, and then accidentally mistype a key, it shouldn't (in my opinion) silently create a list, effectively hiding the bug.