Re: Lost in Ashok's teachings

Liste des GroupesRevenir à cl tcl 
Sujet : Re: Lost in Ashok's teachings
De : luc (at) *nospam* sep.invalid (Luc)
Groupes : comp.lang.tcl
Date : 27. Sep 2024, 02:59:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240926225956.087d515c@lud1.home>
References : 1 2 3 4
On Thu, 26 Sep 2024 22:17:46 +0530, Ashok wrote:

Replace it with tcl::mathop::+
Somewhere earlier in the book, I think I mention that the rest of the
book assumes a "namespace path tcl::mathop" which is why there is that
standalone "+". Was a bad idea in hindsight just to save the clutter of
tcl::mathop:: prefixes everywhere.

**************************
On Thu, 26 Sep 2024 18:53:11 +0200, Ralf Fassel wrote:

That is TCLs mathop:
 https://www.tcl-lang.org/man/tcl/TclCmd/mathop.htm
>
   % namespace path {::tcl::mathop}
   % + 4 5
   9
>
See also
 https://wiki.tcl-lang.org/page/tcl%3A%3Amathop?R=0&O=mathop&W=

**************************
On Thu, 26 Sep 2024 22:28:17 -0000 (UTC), Rich wrote:

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

**************************

I was aware of math operations, but have used them very rarely if ever,
so I didn't make the connection. Most important, I had no idea we could
overload our entire code with all the math operations by importing a
namespace. I'm not sure I like it, but it's good to know.

As usual, I am glad I asked despite my usual hesitation. I always end up
learning when I ask. Many thanks. I really appreciate it.

--
Luc
>


Date Sujet#  Auteur
26 Sep 24 * Lost in Ashok's teachings8Luc
26 Sep 24 `* Re: Lost in Ashok's teachings7Ralf Fassel
26 Sep 24  `* Re: Lost in Ashok's teachings6Luc
26 Sep 24   +- Re: Lost in Ashok's teachings1Ashok
26 Sep 24   +- Re: Lost in Ashok's teachings1Ralf Fassel
26 Sep 24   `* Re: Lost in Ashok's teachings3Rich
27 Sep 24    `* Re: Lost in Ashok's teachings2Luc
27 Sep 24     `- Re: Lost in Ashok's teachings1Rich

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal