Do you know where your variables are? | |
PerlMonks |
Inconsistent for the sake of convenienceby ELISHEVA (Prior) |
on Feb 17, 2009 at 03:22 UTC ( [id://744280]=perlmeditation: print w/replies, xml ) | Need Help?? |
In the past few weeks, thanks to the wonderful Monks, I've discovered at least two examples where Perl parsing seems to be inconsistent for the sake of convenience:
Convenience has been an important part of design of Perl from what I understand. Default variables abound. Typing is implicit. Context affects parsing. There is usually more than one way to do things. But generally, it seems, there is order in the chaos. There are, for example, clear rules for determining when something is list or scalar context and mechanisms for forcing a context if you wish. The same goes for implicit typing. Even the flexibility is consistent. Arguably, even the two examples above are "consistent". A clearly defined contextual rule exists to predict the behavior of $ and while(...). But in another sense, they are not. The context itself, however clearly defined, is a very narrow context, amounting to a special case. Inconsistencies are not necessarily bad for a language. Natural language abounds in them, and one of the things I have always admired in Perl is the way it tries to emulate the convenience and flexibility of natural language. And yet they also pose problems for teaching. Languages, even natural languages, that contain lots of special case constructions are much harder to learn well than fairly regular languages. I'm sure the two examples above are old hat to everyone here, but they were new to me. So now I am wondering what other such "inconsistencies for the sake of convenience" exist in Perl? Would the kind monks care to share additional ones that they have come across? And what are your thoughts on the merits or dismerits of "inconsistency for the sake of convenience?" Best, beth
Back to
Meditations
|
|