|
2007-09-06
| ||
| 09:20 | • Closed ticket [1771726fff]: Forced Variable Types plus 6 other changes artifact: cc2ee122c3 user: sf-robot | |
|
2007-08-22
| ||
| 22:46 | • Pending ticket [1771726fff]. artifact: 01957463c8 user: msofer | |
|
2007-08-11
| ||
| 02:44 | • Ticket [1771726fff]: 5 changes artifact: 849b4edf61 user: dgp | |
| 02:34 | • Open ticket [1771726fff]. artifact: 67c9424e4c user: deusued | |
| 02:22 | • Closed ticket [1771726fff]. artifact: 4ec35a666a user: dgp | |
|
2007-08-10
| ||
| 14:58 | • New ticket [1771726fff]. artifact: 6b481e0f49 user: deusued | |
Forced Variable Types
Closed / Invalid1771726fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-08-10 14:58:12
As a loyal and devout Tcl professional (7+ years), I have come across a situation where I would really -love- to be able to force a variable type, or cast it, as a single type.
While this may incur overhead, I would like to believe that it could be implemented in such a manner that both execution speed would be significantly faster (no casting required if a specific bit is set on the variable) and potentially reducing the memory overhead necessary to cast (I'm out of water here, though).
ex:
%set -double myDouble 1.002
%lappend myDouble 2
/error thrown, much like passing an array in as the first arg/
%set -string myString "1.01"
%expr $myString + 2.01
/error thrown, much like passing {} in/
dgpplain2007-08-11 02:22:33
Logged In: YES user_id=80530 Originator: NO To restrict the set of values a variable may hold, use variable write traces.
deusuedplain2007-08-11 02:34:47
Logged In: YES user_id=741274 Originator: YES I must not have conveyed my interest well. I need -not- to restrict what variable types a variable may contain -- I know exactly what type I am using. I am looking for a significant reduction in memory usage as well as speed reduction (by forcing casting) *without* increasing cost (by way of time). I am -not- going to be tracing them. I am talking about a problem of scale, not a problem of usability.
dgpplain2007-08-11 02:44:31
Logged In: YES user_id=80530 Originator: NO Are you suggesting a change so radical that a Tcl variable would be able to hold a value that was not a Tcl_Obj ? (Trying to make sense of phrases like "forcing casting" in this context. Tcl does not do "casting". Its model is to treat values as strings). If scaling issues are the real problem, has miguel's recent work on Var Reform (Tcl Path 1750051) helped at all? That patch is reported to cut Tcl variable memory usage in half. If I still don't get it, perhaps a proposed patch is the clearest way for you to express to us precisely what it is that you want.
msoferplain2007-08-22 22:46:16
Logged In: YES user_id=148712 Originator: NO There is no way of doing what you want, not in Tcl. The first example could indeed be done via traces, and it could (in principle) be done within the core. But at a huge cost in complexity, and ... having options to [set]? I do not think this can fly. The second example is fundamentally impossible: you are asking the variable myString to be able to only hold string values (that cannot be reinterpreted as something else? NOT Tcl at all!). You are also asking the value $myString to KNOW it is held in such a variable. I do not have enough info to understand where you see memory or runtime savings with such an approach, should it be feasible at all. Please provide detailed info - or even a patch, as suggest below.
sf-robotplain2007-09-06 09:20:05
Logged In: YES user_id=1312539 Originator: NO This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.