Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TIP #122: Use tcl_{non,}wordchars Throughout Tcl/Tk

2 views
Skip to first unread message

Martin Weber

unread,
Dec 13, 2002, 11:00:03 PM12/13/02
to

TIP #122: USE TCL_{NON,}WORDCHARS THROUGHOUT TCL/TK
=====================================================
Version: $Revision: 1.1 $
Author: Martin Weber <ephaeton_at_gmx.net>
State: Draft
Type: Project
Tcl-Version: 8.5
Vote: Pending
Created: Thursday, 12 December 2002
URL: http://purl.org/tcl/tip/122.html
WebEdit: http://purl.org/tcl/tip/edit/122
Post-History:

-------------------------------------------------------------------------

ABSTRACT
==========

This TIP shall bring flexible management of word and non-word chars to
Tcl, to be used throughout the Tcl realm in e.g. [regexp]'s \m \M, Tk's
[textwidget], etc.

SPECIFICATION
===============

Assignment to _tcl_{non,}wordchars_ shall influence any place in Tcl
which decides whether something is a word character or not, including
detection of word boundaries in e.g. regular expressions, Tk's text
widget and so on.

For this there shall be no hard-coding of lists of values which are
word and non-word characters, and neither shall the language rely on
the language of implementation (i.e. C's _is*()_ functions), as this
disallows dynamic changing of _tcl_{non,}wordchars_.

Rather shall the value(s) of _tcl_{non,}wordchars_ be used to determine
whether a given character is part of a word or not.

RATIONALE
===========

Currently in Tcl there are different hard-coded ways to decide whether
a certain character is a word character or a non word character.
Different hard-coded ways also imply that changes on one side might not
get over to the other side, so there soon are different hard-coded ways
which yield different hard-coded results. As a inference of it being
hard-coded, this also means that there is no way to change or fix that
potentially broken behavior. Having Tcl lookup the values of those
variables at runtime allows for the needed flexibility, both when
dealing with nonstandard demands and nonstandard character sets.

There may be a problem with the performance of the lookup, but on the
other hand are C's _is*()_ functions also implemented via a table
lookup. An installation of a caching static character table could
guarantee the needed performance.

IMPLEMENTATION
================

None yet.

COPYRIGHT
===========

This document is placed in the public domain.

-------------------------------------------------------------------------

TIP AutoGenerator - written by Donal K. Fellows

[[Send Tcl/Tk announcements to tcl-an...@mitchell.org
Announcements archived at http://groups.yahoo.com/group/tcl_announce/
Send administrivia to tcl-announ...@mitchell.org
Tcl/Tk at http://tcl.tk/ ]]

0 new messages