Sujet : Re: Lost in Ashok's teachings
De : apnmbx-public (at) *nospam* yahoo.com (Ashok)
Groupes : comp.lang.tclDate : 26. Sep 2024, 17:47:46
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vd437i$8hp5$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 9/26/2024 6:45 PM, Luc wrote:
On Thu, 26 Sep 2024 11:21:14 +0200, Ralf Fassel wrote:
You have ommitted the constructor from Ashoks example which initializes
the 'Balance' variable. In your class, this variable is simply not
initialized, which leads to the error.
True. Thanks.
What about that plus sign? Where is it defined?
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.
Regarding the code testing, the book build process runs every snippet of code and the output generated in the book is actually from running each example at book build time. Very few exceptions to that. Any errors abort the build process. The OO code should therefore run without errors (in the book, not sure of the online version which was an earlier draft).
As for the rest of your comments, fair enough that you do not like the approach. You might try the other books in this space, like the one from Clif Flynt, or the online tutorial at
https://wiki.tcl-lang.org/page/Tcl+Tutorial+Lesson+OOP1/Ashok