Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-09-08
23:18 • Ticket [219229ffff] source should accept all fconfigure options status still... artifact: 0c005b8476 user: dgp
2001-04-04
03:49 • Ticket [219229ffff]: 3 changes artifact: 1f0a589651 user: dgp
2001-03-02
06:25 • Ticket [219229ffff]: 2 changes artifact: 7daaeb5de1 user: dgp
2000-11-21
16:50 • Closed ticket [219229ffff]. artifact: 6dfb0a1e0c user: dkf
2000-11-18
05:35 • Ticket [219229ffff]: 4 changes artifact: 7f245f12d5 user: dgp
00:34 • Ticket [219229ffff]: 4 changes artifact: 72149ca6cf user: nobody
2000-11-17
19:12 • Ticket [219229ffff]: 2 changes artifact: 6cb296f36d user: andreas_kupries
2000-11-10
22:42 • Ticket [219229ffff]: 4 changes artifact: 4f3dedf58e user: dgp
21:00 • Ticket [219229ffff]: 4 changes artifact: 84b309e33b user: dkf
2000-10-26
05:03 • New ticket [219229ffff]. artifact: f0550334dc user: nobody

source should accept all fconfigure options

Closed / Wont Fix219229ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 23 years ago
Descriptionplain2000-10-26 05:03:52
OriginalBugID: 4226 RFE
Version: 8.3
SubmitDate: '2000-02-22'
LastModified: '2000-04-26'
Severity: SER
Status: Assigned
Submitter: welch
ChangedBy: hobbs
RelatedBugIDs: 1453
OS: All
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


The source command should accept all the fconfigure options
so that you can source files in different encodings,
different eofchars, etc. etc.  Remember that the Mac has
a -rsrc (-resource?) flag that we'll have to pay attention to, too.
dkfplain2000-11-10 21:00:45
You can just use open/read to load in the file any way you want and then eval (or uplevel) the result.  This gets you 99% compatability, and very few people seem to use [info script] which is the other 1%...
dgpplain2000-11-10 22:42:56
...and the expanded syntax [info script ?filename?]
in Tcl 8.4 looks like it will provide (most of?)
that other 1%.
andreas_kupries Ticket [219229ffff]: 2 changes [History diff]2000-11-17 19:12:31
nobodyplain2000-11-18 00:34:12
I don't agree that open/fconfigure/read/eval is an adequate work-around.  For a large script, that seems to impose significant memory overhead on the applicatoin.  Perhaps I'm wrong, but doesn't [source] eval and discard the script each time [info complete] would return 1?  -- Chris Nelson
dgpplain2000-11-18 05:35:38
No, Chris, [source] is just script-level access to
Tcl_EvalFile(), and that slurps up the whole contents
of the file into a script, then Tcl_EvalEx()'s the script.
No memory savings in [source].
dkfplain2000-11-21 16:50:02
Closing this, as a full workaround (which can also do more than was envisaged by the original bug submitter) is available.
dgp Ticket [219229ffff]: 2 changes [History diff]2001-03-02 06:25:07
dgp Ticket [219229ffff]: 3 changes [History diff]2001-04-04 03:49:08
dgpplain2003-09-08 23:18:53
Logged In: YES 
user_id=80530


FWIW, TIP 137 supplies the -encoding
option to [source] in Tcl 8.5.  Also
the cross-platform -eofchar for [source]
is fixed as the character \u001a (Control-Z)
starting with Tcl 8.4 (Starkit support).
Log in (anonymous is fine) to add a comment.