Overview
| Artifact ID: | ec9578399d77d3e37b32092fb5891b64b94157e573be9f7c65c33709bcc6cf75 |
|---|---|
| Ticket: | b5bd08df8d61b4ea9bf0cc885f790b367c430a9f
The "int" type registration should be restored. |
| User & Date: | sebres on 2024-06-24 18:02:42 |
Changes
- icomment:
The checks for int-type have mostly nothing to do with shimmering, vice versa sometimes it helps to avoid shimmering, e. g. if object is not int try index or option (compare string) or whatever type... It also may help to avoid generation of string representation, etc. For everyone who used types it is clear that the object may be an integer but have different type. What didn't exclude simple optimizations in case it is already an int-type. The suggestion in TIP to create int-object to obtain a type (and remove it hereafter) is dirty workaround and cannot be really considered as normal solution, at least for normal known types (especially if they were already there previously). Also suggested by Jan `Tcl_GetNumberFromObj` is not really an alternative - why if one needs to consider int-type only (for whatever reason), one has to use function which also checks doubles, bignums, etc... let alone, the branch mispredictions... even in ideal cases, not to mention up to 9 jumps in worse case, for instance, if it is not an integer and the check was previously simple (not int, then try index or compare string). I'll try to summarize the arguments for type-registration: - performance - simplest way ever to check whether the argument is **already** an int, so may be used for... - shimmer avoidance (if objv[i] may be an int and some other type), or... - preventing the generation of string representations (it'd remain pure int) - check whether object is plain - etc. The Tcl source code itself is full with `TclHasInternalRep(..., &tclIntType)`, so why the extensions may not need that (or shall use weird workarounds). Please stop think for the devs how it is better for them to do something. Many people knows it already, and for others one can improve the documentation or explain the shimmering or whatever consequences instead.
- login: "sebres"
- mimetype: "text/x-markdown"