Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8b7deb8b4e99d7de5236cee7c6f0c70436cff32059a90f2a91872a013667ee09
Ticket: b5bd08df8d61b4ea9bf0cc885f790b367c430a9f
The "int" type registration should be restored.
User & Date: jan.nijtmans on 2022-11-17 20:16:46
Changes

  1. icomment:
    Indeed, I also question why *any* type should be registered at all. For int's and bignum's there's a better solution now: Tcl_GetNumberFromObj() (TIP #638). This function can determine whether a Tcl_Obj is an integer or a bignum without shimmering. In my opinion, the best way for Tcl 9.0 is - indeed - remove the registration, so extensions will start using Tcl_GetNumberFromObj(). Problem solved.
    
    For Tcl 8.7, the registration for "int" is only a compatibility Tcl_ObjType. Any operation on it will shimmer the "int" to a "wideInt", so any code using Tcl_GetObjType("int") will basically not work as expected anyway. Does it hurt? Not really, because this functionality is only used as optimization, this optimization will just do nothing in Tcl 8.7 any more. If extension start using Tcl_GetNumberFromObj(), the optimization will start working again.
    
    The reason why other Tcl_ObjTypes are still registered is simply because there is no good alternative yet. List's can easily shimmer to Dicts's, so - eventually - there could be a Tcl_GetListOrDictFromObj() helping in that.
    
    Hope this clarifies the situation a little.
    
  2. login: "jan.nijtmans"
  3. mimetype: "text/x-fossil-wiki"