<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Right that arrays of chars/widechars make good strings, however you run into the problem of what is the ubiquitous type that is good to have around because any other code can deal with it. It's often nice to have fewer types and therefore more easier interoperability among code -- avoid any thick translation layer or conversion of data back and forth. It's tough though of course, since not one size (type) fits all.<BR>
<BR>
It seems annoying and wasteful, but also plain ok, for everyone to have their own string, array, list, etc. types.<BR>
My "crazy" view though is that it is better to have one string class per programmer than any programmer with no string type to use. Fewer types/libraries would be preferable, but the alternative of anyone having none is worse.<BR>
It is easy enough to write these things for yourself if there really is no acceptable existing option. (though the ease with which folks dismiss existing alternatives is also bad)<BR>
Some people claim they need to leave the writing of string/array/list to the super-skilled library developers, but I don't think so. The line between library producer and library consumer is not always so clear. I may not be capable of whipping together a windowing system or a threading library or compiler, but string and growable array are plenty easy enough. :)<BR>
Sometimes the library writers aren't even so good.. I remember reading, if I interpreted it correctly, how the Python developers were so proud of their growable arrays that are so efficient because they grow in chunks of constant size larger than 1...except that's not actually how you write an efficient growable array, you have to grow exponentially -- by a factor greater than 1, such as 2 or 3 or 1.5. This is for the scenario of folks adding one element at a time.<BR>
<BR>
I also found Modula-3 arrays to be a little disappointing so far. Could be me at this point.<BR>
I'd like to be able to change their length and possibly remove elements from the start without a copy.<BR>
I suppose that involves a dreaded "interior pointer" and gc problems.<BR>
I know SOME about SUBARRAYS but so far, it seems SUBARRAY can only be passed as parameters or use in "surprisingly powerful" assignment: subarray(a, offset, length) := subarray(b, offset, length). It seems I cannot assign, like, a subarray to a reference. a: array [0..9] of integer, b : ref array [8..9] of integer := subarray(a, 8) ? I'll have to look into that too..<BR>
<BR>
Really I was going to try to shut up today at Randy's request but folks responded.. :)<BR>
<BR>
- Jay<BR><BR><BR>
<HR id=stopSpelling>
<BR>
> Date: Tue, 26 Feb 2008 17:14:31 -0600<BR>> From: rodney.bates@wichita.edu<BR>> To: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] text inefficiency? good mutable string type? arrays?<BR>> <BR>> Mutating the Text implementations certainly could subvert the expected<BR>> semantics of TEXT, for other TEXT values you might not expect to have<BR>> any relation to what you are doing.<BR>> <BR>> But in my view, the much more important point is that ARRAY OF CHAR/<BR>> WIDECHAR, where you create your own values, are the mutable strings<BR>> in Modula-3. You can pretty much do anything you want with this,<BR>> including writing your own string abstraction, with different internal<BR>> representation. In fact, I have done so, highly tailored to an<BR>> application with specific, known performance characteristics and<BR>> usage patterns.<BR>> <BR>> Jay wrote:<BR>> > Is that legal or is that subverting things?<BR>> > It depends on the context?<BR>> > Can the pointers be to read only memory in the code?<BR>> > <BR>> > - Jay<BR>> > <BR>> > <BR>> > ------------------------------------------------------------------------<BR>> > <BR>> > > From: hosking@cs.purdue.edu<BR>> > > To: mika@async.caltech.edu<BR>> > > Date: Tue, 26 Feb 2008 15:16:47 -0500<BR>> > > CC: m3devel@elegosoft.com<BR>> > > Subject: Re: [M3devel] text inefficiency? good mutable string type? <BR>> > arrays?<BR>> > ><BR>> > > ARRAY OF CHAR/WIDECHAR?<BR>> > ><BR>> > > These are available in the various Text implementations. For exampe,<BR>> > > Text8.T.contents. One can freely mutate these at leisure and the<BR>> > > higher-level text will appear to change!<BR>> > ><BR>> > > On Feb 26, 2008, at 2:22 PM, Mika Nystrom wrote:<BR>> > ><BR>> > > > Olaf Wagner writes:<BR>> > > >> Quoting Jay <jayk123@hotmail.com>:<BR>> > > >><BR>> > > >>> I know this area has been brewing under the surface a while.<BR>> > > >>> I'll bring it up. :)<BR>> > > >>><BR>> > > >>> I assume texts are read only?<BR>> > > >><BR>> > > >> Yes.<BR>> > > >><BR>> > > >>> I know lots of systems have read only strings.<BR>> > > >>> There are pluses and minus to them. They can be single-instanced.<BR>> > > >>> Some systems with read only strings have another type, such as<BR>> > > >>> "StringBuilder" or "StringBuffer".<BR>> > > >>> So -- I don't have a specific question, but maybe a mutable string<BR>> > > >>> "class" aka "type" is needed?Not necessarily in the language but in<BR>> > > >>> m3core or libm3?<BR>> > > >>> Maybe it's already there?<BR>> > > ><BR>> > > > CharSeq.T?<BR>> > ><BR>> > <BR>> > <BR>> > ------------------------------------------------------------------------<BR>> > Climb to the top of the charts! Play the word scramble challenge with <BR>> > star power. Play now! <BR>> > <http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan><BR>> <BR>> -- <BR>> -------------------------------------------------------------<BR>> Rodney M. Bates, retired assistant professor<BR>> Dept. of Computer Science, Wichita State University<BR>> Wichita, KS 67260-0083<BR>> 316-978-3922<BR>> rodney.bates@wichita.edu<BR><BR><br /><hr />Climb to the top of the charts! Play the word scramble challenge with star power. <a href='http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan' target='_new'>Play now!</a></body>
</html>