The importance of 'transparency' in data structuresThe other day's entry on why Perl is not my favorite language produced an interesting comment exchange between me and a friend that touched on how transparently Perl can embed data structures in other data structures. (In specific, that one can't transparently put aggregates, lists and hashes, straight into and out of other aggregates.) Why does this matter? Because every time you have a lack of transparency with data structures, you have to be aware of the actual types that you are working with. Being aware of the actual types complicates changing the program later, and complicates some design patterns always. For example, the Python design pattern to introduce a lookup cache is pretty simple and quite general:
This works for almost anything. (Honesty compels me to admit that it
doesn't work for iterators; for why, see
GeneratorGotchas. There are also some The equivalent pattern in Perl has to either use explicit references
or know that This also complicates changing what (Part of this is my computer science background being neurotic, because it is dissatisfied by irregular things and exceptions.) |
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |