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 >> tcljava-dev
tcljava-dev
[tcljava-dev] SubstCmd
by Justin Ryan other posts by this author
Apr 10 2007 8:52PM messages near this date
Re: [tcljava-dev] tcl interpr from eclipse plug-in | Re: [tcljava-dev] SubstCmd
I'm having a problem with the subst command, in which the java version
differs from the c version. In the C Tcl:

% set str "Hello\rWorld\r"
World
% puts [string length $str]
12
% puts [string length [subst $str] ]
12

You can see that the \r stays in the string. While in Jacl:

% set str "Hello\rWorld\r"
World
% puts [string length $str]
12
% puts [string length [subst $str] ]
10

If you delve into the string, it's missing the \r characters on Jacl.
There's an explicit line in SubstCmd.java that excludes this
character.  The comment nearby says that it might not be compatible on
a Mac. I can't say either way if it incompatible with the Mac, but I
can say for sure that it's incompatible with Tcl. Does anyone know why
this bit was added? Can it be removed?

I use subst for variable substitution on string passed into me, and I
can't have it missing characters.  My work around was to rewrite the
subst command, but since SubstCmd has package private privileges, I
couldn't just extend it. I had to copy and paste from SubstCmd.java.
Is there a reason that so many of the jacl/tcljava classes don't
define themselves as public classes? If a specific class shouldn't be
extended then it could be defined as final.

justin

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
tcljava-dev mailing list
tcljava-dev@[...].net
https://lists.sourceforge.net/lists/listinfo/tcljava-dev
Thread:
Justin Ryan
Mo DeJong

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