Originally Posted By: argv0
Then what you're suggesting clearly cannot work.

$calias inside pcc would return pcc, not the callee. If you wanted it to return only the callee, then you could not do error checking inside the alias itself, for instance:

Code:
alias bl_alias1 { 
  if ($1- == $null) { echo -a * $calias $+ : insufficient parameters. | return }
  ...
}


Instead you would require all error checking to be done in an alias directly called by the alias in question, which ends up being more limiting than it is helpful.

Do you refuse to read what I do say or so?
Code:
alias blacklist_add {
  if ($pcc($calias,6,$1-)) { return }
  ...
}

Notice how $calias replaces the hardcoded name 'blacklist_add' of the alias here.
Where do you see your "$calias inside pcc" ?
$calias is used inside the code of alias blacklist_add.
Then I can copy this line to another alias of this blacklist_* set without having to change anything but the required number of blacklist_add - parameters in the second parameter of $pcc()
This is what is in the title of my feature suggestion: 'Current alias' - identifier
That's ONE.

Originally Posted By: argv0

I assume in response to this situation you would suggest that we should have two separate identifiers, $calias and $callee for the two situations... but then what about a scripter who might write the above as:

That two separate identifiers was already suggested in my openingpost. Care to read?
Quote:

It would be handy to have some identifier in an alias that returns the name of the called alias (maybe $calias - similar to $ctimer) AND/OR another identifier that returns the name of the alias the code belongs to.
That would eliminate all the hardcoding.

Regarding which name for which of the two, is a matter of choice, not a matter of feature suggestion ok or not ok. the 'c' in $calias can refer to both 'current' and 'called' so maybe (as said) $calias for the called from aliasname (similar to $ctimer) and $nalias for the name of the alias the code belongs to, I'd find just $alias better similar to $sockname $script etc but its already used.

Originally Posted By: argv0

Code:
alias bl_alias1 { pcc 3 | ... }
alias pcc { 
  if ($0 < $1) error_insufficient_params 
  if ($1 == ...) error_invalid_params
}
alias error_insufficient_params {
  echo $color(info) -a * $callee $+ : insufficient parameters
}
alias error_invalid_params {
  echo $color(info) -a * $callee $+ : invalid parameters
}


Clearly you end up with a case where arbitrary levels of "callee" indirection are needed depending on the level of organization a scripter would use. What you're suggesting is helpful to your specific script organization, not that of other scripters. Of course, again, this is solved by using proper stack traces as per standard try/catch exception handling, which is really what you're alluding to here.

As far as the "less code" argument goes, you're not writing "less" code:

Code:
alias c1 {
  if ($somecheck(c1,3)) return
}


is technically "less code" than the equivalent with $calias.

As I mentioned in the first reply, maintainability is really insignificant in this situation. When you change the alias name you'll be doing more work fixing the calls to the alias than fixing the one extra reference inside the alias body. You also generally don't rename aliases often to begin with.

Given that the only benefit from knowing the alias name is for the one situation where a scripter performs error reporting, it seems to me that this is really more about the error reporting than the alias name itself.

You obviously endup wherever you want regardless of what I do say. In my example I used one alias named 'pcc' (Parameter Count Check) to report insufficient parameters errors for the whole script, to save every individual alias from having the reporting code and also to have one editing place to adjust it (hurah for reusing code and less work!), and what do you do: you let that one single place/alias on its turn call other aliases to report besides insufficient pars also invalid pars, in order to bring up a 'problem' with my feature suggestion. That's TWO.
Notice how you constantly move away of what I said?



Last edited by RRX; 21/05/09 08:34 PM.