Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?
De : aotto1968 (at) *nospam* t-online.de (aotto1968)
Groupes : comp.lang.tcl
Date : 28. Jan 2025, 23:00:51
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vnbk2j$20pk0$1@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
I'm still struggling with myself as to whether "myoo" should be reference-based or namespace-based.
after doing some research with the tcl-only API, I've now switched to C. Unfortunately, the public namespace C API is rather weak and only "string" based, which has now prompted me to switch to the semi-public "Int" API, where at least there is usable "namespace" support. After the first analysis, I can now say that "namespace-based" is currently faster.
package require libmyoox
 > 1.0
::myooX::ClassN ::MyClassN {
   proc MyClassN {myNs num} {
     namespace upvar $myNs my my
     set my(num) $num
   }
   proc get {myNs} {
     namespace upvar $myNs my my
     set my(num)
   }
}
 > ::MyClassN::cls
::myooX::ClassN ::MyClassR {
   proc MyClassR {myRef num} {
     upvar $myRef my
     set my(num) $num
   }
   proc get {myRef} {
     upvar $myRef my
     set my(num)
   }
}
 > ::MyClassR::cls
set ns1   [::myooX::NewN ::MyClassN 1]
 > ::MyClassN::MyClassN-1
set ref2  [::myooX::NewR ::MyClassR::cls 2]
 > ::MyClassR::MyClassR-1::my
::MyClassN::get $ns1
 > 1
::MyClassR::get $ref2
 > 2
time {::myooX::NewN ::MyClassN       1 } 10000
 > 10.244 microseconds per iteration
time {::myooX::NewR ::MyClassR::cls  2 } 10000
 > 15.086 microseconds per iteration
time {::MyClassN::get $ns1  } 10000
 > 1.6015 microseconds per iteration
time {::MyClassR::get $ref2 } 10000
 > 2.4201 microseconds per iteration

Date Sujet#  Auteur
10 Jan 25 * OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?10aotto1968
16 Jan 25 +- Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?1aotto1968
23 Jan 25 +- Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?1aotto1968
25 Jan 25 +- Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?1aotto1968
28 Jan 25 +- Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?1aotto1968
30 Jan 25 +- Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?1aotto1968
5 Feb 25 +* Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?3aotto1968
7 Feb 25 i+- sometimes the most beautiful thing in the world is a CRASH that brings so much new knowledge1aotto1968
14 Feb 25 i`- This example looks simple at first, but differs in detail.1aotto1968
30 Mar 25 `- Re: OK, what looks better. The OLD tcl-oo or the NEW tcl-oo?1aotto1968

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal