Sujet : Re: Lost in Ashok's teachings
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tclDate : 26. Sep 2024, 23:28:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vd4n61$d3p6$1@dont-email.me>
References : 1 2 3
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Luc <
luc@sep.invalid> wrote:
On Thu, 26 Sep 2024 11:21:14 +0200, Ralf Fassel wrote:
What about that plus sign? Where is it defined?
A bit of 'context' would help us in actually knowing to what you are
referring. I'm assuming you mean this construct from your original
post:
[+ $var $var]
That + is the "proc" version of the addition operator. It is
accessible as either:
$ rlwrap tclsh
% ::tcl::mathop::+ 1 2
3
%
Or by setting up a namespace path within your current namespace, which
then allows you to call the proc without the absolute namespace names:
% namespace path {::tcl::mathop}
% + 3 4
7
You can also access the math functions (i.e., sin(), abs() etc) in a similar
way (they exist in ::tcl::mathfunc::)
% namespace path {::tcl::mathop ::tcl::mathfunc}
% sin .2
0.19866933079506122
% abs -4
4
Presumably, somewhere in an earlier chapter of Ashok's book, he
detailed the above little setting to be able to call the math operators
(and/or functions) as procs. But as the full book is not on the web,
you would not have had the benefit of having read that material prior
to reading the OO chapter that is available.