|Don't ask to ask, just ask|
Re^2: How to make Win32::API easy to useby tye (Sage)
|on Jun 02, 2004 at 20:56 UTC||Need Help??|
This hits on a difference in our "Perl views" (like "world views") that has come up before. I find aliases in Perl to be a special case and so I prefer to avoid them except in certain situations.
I guess my heuristic is to avoid using them except across very short distances. The distance between the call to bind() and the definition of sub bind is pretty big, if you look at it one way.
However, Perl's read sets a precedent that I sometimes follow and this case is close enough that I could certainly make arguments that it would an appropriate use here. But I also see two reason why someone wouldn't do this. The first is avoiding user surprise as I tried to explain briefly above (and probably failed).
To make it more concrete, we don't have (w/o using C code not built into Perl) the ability to do:
so using aliases in your API restricts how people can use your API. (And I don't think my last example could be used even if you allow for a module including C code.)
The second reason is "comfort" of implementation, which I see fits exactly the "not thinking of your users" problem I brought up.
In Perl4 we had globs. In Perl5 we got references. In Perl6 we'll finally get full control over aliases and so they'll finally be acceptable to me to use in more general ways (I suspect).