Am 12.05.20 um 01:23 schrieb Ali M:
> tip 571 is suggesting adding a new command to specify a call strategy
> for a command call
>
> example from the tip
https://core.tcl-lang.org/tips/doc/trunk/tip/572.md
>
> # Specify the call strategy for the command: manipulateData (Only the fifth argument will be passed by value. The other ones will be passed by name)
> callstrat manipulateData & & & & * &
>
> #Call the target procedure
> manipulateData a b c d $e f
Thank you for the suggestion. It goes into another direction of
discussions that we had previously.
> please note, its been while since i touched tcl, so i can be completely off
>
It is nice that you submitted the TIP with a complete implementation in
C already, that gives good feeling for the performance which can be
achieved. I think the command does not change the basic Tcl semantics
and could also be implemented as a script by renaming the target
procedure to some alias in a namespace and wrapping it with upvar code.
There has been an extensive discussion about named arguments in response
to the Tcl bounties from flightaware
https://github.com/flightaware/Tcl-bounties
They wanted a standard way to parse -option like arguments, and
call-by-reference arguments were part of that discussion. See
http://www.tcl.tk/cgi-bin/tct/tip/457.html for the most complete
implementation. Sadly, the different tastes in the community and the
core team stalled the development.
In my opione, citing from your TIP:
> The important thing in this feature is to preserve the backward compatibility and not to change the procedure definition signature.
I don't like this. I think that it is an advantage to see in the
procedure signature the reference variables, because they are intended
to be modified. In C++ const refs are also used to save copying, for Tcl
with COW that does not play a role. In addition, I don'T like that I
have to count the positional arguments. In your exmaple, when seeing
callstrat & & * &
it's confusing which parameter is modifiable, because the parameter
names are missing. Of course I could add them myself, but then there are
two lines of code which I need to keep in sync, whenever the number or
order of parameters changes.
Best regards,
Christian