What you don't seem to realize is that your suggested identifiers do *not* eliminate all hardcoding in all cases, only in the specific scenario you brought up. If you pay attention to the example that you conveniently omitted in my quote, you would notice that you would need a 3rd level indirection of callee to implement it, making your suggestion limited only to examples you personally use (your code is not how I would implement error handling at all and those proposed identifiers would be completely useless to me).

You also have yet to address the fact that "hardcoding" is really not as serious an inconvenience as you suggest it is. In fact as I've pointed out, you only type the name once per alias-- that's exactly once more than you normally would (the "alias MYNAME" declaration) instead of the one more time you would otherwise type $calias. This, again, is only limited to aliases, and then further limited to those exposed to your users, making it, imho, a small subset of any real-world script. In fact, I bet the total word count of your posts greatly exceeds the number of times all of your hardcoded alias names appear in all of your scripts.

You have also yet to address the fact that this really hides the underlying issue here, which is error checking. This is my major concern. Error checking seems to be the only usage you have for such an alias, or at least I can personally think of no other serious uses for the current alias name. If you have another example, please share. Otherwise, if your suggestion for $calias is only to make the one use case of error checking better, there are better ways to do that. Better ways that do not include hacking on an extra alias that only makes dealing with errors marginally better in the one use case where you need to /echo the alias name out to a user.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"