[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] using mmap files as strings?
From: |
F. Wittenberger |
Subject: |
Re: [Chicken-users] using mmap files as strings? |
Date: |
Wed, 27 Oct 2010 18:45:32 +0200 |
Am Mittwoch, den 27.10.2010, 09:23 -0600 schrieb Alan Post:
> In a lisp system I worked on a few years ago, I have both a string
> type and a "static" type. They both acted like strings, but the
> static type had a pointer+len to non-memory-pool memory, rather than
> allocating the string data with the object. I believe also the
> static object was read-only, for my own simplicity.
This is in fact (for the sake of simplicity) what I have in mind I'd
love to have. I can live with immutable strings as input source. It
might require some thinking, but I bet my a* on it that this additional
care would pay off in many situations.
> I had also wanted to implement substrings, but the problem I ran
> into was that I may have a pointer *only* to a substring when the GC
> was called, and I had no way to access the full string and make sure
> it was properly copied. I wasn't using your suggestiong above of
> having a pointer, start, and end, though I'm not sure why.
I wouldn't be either. My contemplations took a some time already. With
the chicken source code in front of my eyes. That's a bad sign to
me. :-/
However
Am Mittwoch, den 27.10.2010, 09:17 -0700 schrieb Kon Lovett:
On Oct 27, 2010, at 5:02 AM, Jörg F. Wittenberger wrote:
>
> <snip>
> >
> > However this would somehow have to overwrite the basic string
> > handling.
> > I have not yet tried that, but at least the utf8 egg hints that it
> > must
> > be possible to do so.
>
> Not completely. Chicken library code uses sys namespace routines &
> cached bindings for many string operations. Hooking the Chicken
string
> representation in a routine by routine fashion will probably be
brittle.
>
I recently noticed that several of the ##sys# prefixes have been
eliminated recently (elsewhere in the code).
Also I must ask here: do those namespaces have any special effect
besides a new symbol table entry? If not (and that's what my
observations indicate) it should be possible to just overwrite the
bindings. At worst it might be a case of making sure the overwrite
happens early enough, at least before the caching.
...or early enough with some help by our friendly chicken.
I mean: some Scheme compiler(s) allow call/cc only with a command line
switch. Why should chicken not get yet another one, enabling shared
substrings (which would mean to use half way replaced string handling).
I would contribute on that one.
> pointer to the string and an index. I rarely need to know the full
> length of the string,
But the length of the substring, don't you?
- Re: [Chicken-users] using mmap files as strings?, (continued)
Re: [Chicken-users] using mmap files as strings?, F. Wittenberger, 2010/10/27
Re: [Chicken-users] using mmap files as strings?, Kon Lovett, 2010/10/27