ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
Re: [TCLCORE] [SPAM] [6.0] Re: base64 in the core?
by Donal K. Fellows other posts by this author
Apr 28 2008 6:37AM messages near this date
Re: [TCLCORE] [SPAM] [6.0] Re: base64 in the core? | Re: [TCLCORE] [SPAM] [6.0] Re: base64 in the core?
Kevin Kenny wrote:
>  Uhm, Donal, excuse me?  This is a simple forward iteration. Keep an
>  index into the string rep - as opposed to the 'string' internal rep.
>  (That one never shimmers.)  On each trip through the loop, decode
>  one UTF-8 character and advance the index around it.  There's no
>  real slowdown because you don't need to get into quadratic behaviour
>  counting the UTF-8 characters (the way a naively coded [string index]
>  loop at Tcl level would).
>  
>  If you want to cache single character strings (at least for
>  ISO8849 characters), go for it.  But I suspect that in most uses
>  of this, the single characters would be short-lived.

Bah, this whole discussion is getting out of hand (and I'm highly
irritable today because I'm teaching). For the business of [string
foreach], I'd be perfectly happy to see an implementation as you
describe it. Since it's iterating by single characters, the benefit of
buffer sharing would be slight. Whether or not to cache character-objs
would be a question to decide at a later date.

The general question of string rep sharing is complex, and a massively
over-heavy hammer for this particular nut. (Another objection to it I've
just thought of is that it would cause the loss of the NUL-termination
property, with consequent implications for the core of Tcl and many
extensions; quicker and simpler to just copy the string to a new buffer.
This particular point doesn't apply to byte arrays.)

Donal.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Trevor Davel
Pat Thoyts
Kevin Kenny
Donal K. Fellows
Larry McVoy
Donal K. Fellows
Larry McVoy
Donal K. Fellows
Kevin Kenny
Donal K. Fellows
Larry McVoy
Donal K. Fellows
Alexandre Ferrieux
Lars Hellstrom
Donal K. Fellows
Alexandre Ferrieux
Donal K. Fellows
Alexandre Ferrieux
Donal K. Fellows
Alexandre Ferrieux
Larry McVoy

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved