[M3devel] text inefficiency? good mutable string type? arrays?

Rodney M. Bates rodney.bates at wichita.edu
Wed Feb 27 00:14:31 CET 2008


Mutating the Text implementations certainly could subvert the expected
semantics of TEXT, for other TEXT values you might not expect to have
any relation to what you are doing.

But in my view, the much more important point is that ARRAY OF CHAR/
WIDECHAR, where you create your own values, are the mutable strings
in Modula-3.  You can pretty much do anything you want with this,
including writing your own string abstraction, with different internal
representation.  In fact, I have done so, highly tailored to an
application with specific, known performance characteristics and
usage patterns.

Jay wrote:
> Is that legal or is that subverting things?
> It depends on the context?
> Can the pointers be to read only memory in the code?
>  
>  - Jay
> 
> 
> ------------------------------------------------------------------------
> 
>  > From: hosking at cs.purdue.edu
>  > To: mika at async.caltech.edu
>  > Date: Tue, 26 Feb 2008 15:16:47 -0500
>  > CC: m3devel at elegosoft.com
>  > Subject: Re: [M3devel] text inefficiency? good mutable string type? 
> arrays?
>  >
>  > ARRAY OF CHAR/WIDECHAR?
>  >
>  > These are available in the various Text implementations. For exampe,
>  > Text8.T.contents. One can freely mutate these at leisure and the
>  > higher-level text will appear to change!
>  >
>  > On Feb 26, 2008, at 2:22 PM, Mika Nystrom wrote:
>  >
>  > > Olaf Wagner writes:
>  > >> Quoting Jay <jayk123 at hotmail.com>:
>  > >>
>  > >>> I know this area has been brewing under the surface a while.
>  > >>> I'll bring it up. :)
>  > >>>
>  > >>> I assume texts are read only?
>  > >>
>  > >> Yes.
>  > >>
>  > >>> I know lots of systems have read only strings.
>  > >>> There are pluses and minus to them. They can be single-instanced.
>  > >>> Some systems with read only strings have another type, such as
>  > >>> "StringBuilder" or "StringBuffer".
>  > >>> So -- I don't have a specific question, but maybe a mutable string
>  > >>> "class" aka "type" is needed?Not necessarily in the language but in
>  > >>> m3core or libm3?
>  > >>> Maybe it's already there?
>  > >
>  > > CharSeq.T?
>  >
> 
> 
> ------------------------------------------------------------------------
> Climb to the top of the charts! Play the word scramble challenge with 
> star power. Play now! 
> <http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan>

-- 
-------------------------------------------------------------
Rodney M. Bates, retired assistant professor
Dept. of Computer Science, Wichita State University
Wichita, KS 67260-0083
316-978-3922
rodney.bates at wichita.edu



More information about the M3devel mailing list