[M3devel] Windows, Unicode file names

Hendrik Boom hendrik at topoi.pooq.com
Thu Jun 28 14:37:56 CEST 2012


On Thu, Jun 28, 2012 at 05:31:04AM +0000, Jay K wrote:
> 
>   > Random access by *character* number is easy and, hopefully, implemented
>  > with efficiency at least better than O(n).
>  
> 
> Random access by "something, not 'character'" should be O(1).

Quite agree.  There shoule be  a fetch-byte operation, and a 
fetch-characcter operation.  Fetch-character should return a character 
and the index to the next character.

> 
> 
> > > I kind of thing that immutability and quadratic growth are in conflict.
> >
> > They are, to a considerable extent, as with all functional-style data structures.
> > But more sophisticated (i.e., complicated) implementations can mitigate somewhat.
> 
> I'm hoping we can win here somehow.
> In Java and C# they solve this by having, in a sense, two string types.
> constant "string"s
> an mutable "StringBuffer"s
> Strings never grow. They are always flat.
> StringBuffers grow quadratically. They are always flat. They are mutable.
> 
> I suspect we need do something similar. Somehow.
> 
> As I understand, C# and Java do expose string concatenation.
> As I understand, they are similar to Modula-3 here, in that the compiler knows
> about string concatenation and rewrites the code somewhat.
> Thinking about it further, I suspect my example also can't/doesn't run performantly in Java or C# either.
> 
> 
> Hopefully we can come up with some good solution to this.
> I have to run.

Initially, create a string as a simple array of bytes. Then, when 
we start concatenating, use a cm3-like representation.  (we 
could delay this until our string gets a little long, or until a pointer 
to it gets copied.  Maintian that as long as we're still concatenating.  
We might try balancing the tree somewhat if it gets biggish.  
But as soon as we start indexing or hashing, or anything like that, we 
can change representation to the simple array of byte.  Usually at that 
point we're finished concatenating.

-- hendrik

> 
> 
>  - Jay



More information about the M3devel mailing list