Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #52242

Re: 1 /STRING vs SNIP

From "David N. Williams" <williams@umich.edu>
Newsgroups comp.lang.forth
Subject Re: 1 /STRING vs SNIP
Date 2016-10-27 10:16 -0400
Organization University of Michigan
Message-ID <nut26d$cfm$1@dont-email.me> (permalink)
References <cf8661ca-df10-4db9-ac20-4694db5ca04b@googlegroups.com> <9c78f98e-09a2-491e-94dc-e986d24e7c1b@googlegroups.com> <33ec0fc5-7d77-4540-9f6d-c624fb0c6ef4@googlegroups.com> <nuqfri$k4m$1@dont-email.me> <nuqibk$ukf$1@cherry.spenarnc.xs4all.nl>

Show all headers | View raw


On 10/26/16 11:33 AM, Albert van der Horst wrote:
 > In article <nuqfri$k4m$1@dont-email.me>,
 > David N. Williams <williams@umich.edu> wrote:
 >> [...]
 >>
 >> My own dynamic-strings package,
 >>
 >> http://www.umich.edu/~williams/archive/forth/strings/dstrings.html
 >>
 >> with string stack and garbage collection, was apparently too elaborate
 >> to have been taken up by Forthists, although I am fairly proud of it.
 >>
 >> My more conventional ANS Forth string library
 >>
 >> http://www.umich.edu/~williams/archive/forth/strings/mstrings.html
 >>
 >> works with the data stack and buffers allocated by the user.  It is 
lean,
 >> to me at least.
 >
 > I see with respect the neatness and the amount of work that is gone
 > into this. However, if you're honest, can you testify that all
 > those words have been used at least once in your life, or someone else
 > who use the package?

I can't say that I've used them all, beyond testing; but I have used a
fair number of them.  I can't speak for other users.  I actually know of
only one (if memory serves), and that was experimental.

 > If I look at the way I handle strings, I always use a fixed buffer,
 > and merely 5 words that I can remember easily.

I understand the appeal of doing much with few words.  However, I'm
firmly in the library camp.  To me, a library is a collection of words
organized for a purpose for which there is a more or less natural
logical structure.  I find it more of a conceptual load to omit words
that logically "ought" to be there than to include them.  Coming from
there, I admit that I probably get seduced into over-elaboration.  But
actually I'm not so sure it's unjustified.  I guess it's not for me to
say.  It goes without saying that a library needs to be well documented
and tested.

Even worse, I'm in the multiple namespace and multiple stack camps.  :-)

 > Lately I've added .format that uses %xxx with xxx in a user extendable
 > wordlist.
 >
 > The only thing I miss is the word $\ (string-slash-from-behind)
 > analogous to $/ (string slash) :
 > This would do
 > "/home/scan/mimi/test090910.tif" &/ $\ TYPE TYPE
 >
 > /home/scan/mimi test090910.tif

Nice word!

 > Now I'm thinking about how turn a pascal program (file size long string)
 > into a Forth program (idem). My conclusion is that it needs special
 > string handling, closely coupled to an ALLOCATE implementation.
 > This results in a very limited set of words, and very little copying
 > and also very little generality.
 > I'm always am surprised with the ease one introduces string concatenation
 > $+ that can easily lead to quadratic run time in e.g. the above case
 > and immediately confronts one with problems like memory recovery/
 > garbage collection.

It was not *the* design purpose, but this an example of the kind of
thing the dstrings library was designed for.  Before the project got
scooped by the open sourcing of Vermaseren's FORM and the demise of the
ppc, I was well along in a project that was using it to write a text
translater for Veltman's Schoonschip M680x0 assembly language source to
ppc assembly language.

There was also a Forth to pfe C project (which I don't guarantee to work
with the latest dstrings.):

   http://www.umich.edu/~williams/archive/forth/hatforth/

A simpler example, which may even still work, is a text translator I
wrote to translate C library binding descriptions to pfe C bindings:

http://www.umich.edu/~williams/archive/forth/gmpfr/#pfebindings

This was used with the forth-gmpfr bignum package.

-- David

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

1 /STRING vs SNIP foxaudioresearch@gmail.com - 2016-10-18 19:31 -0700
  Re: 1 /STRING vs SNIP Ron Aaron <rambamist@gmail.com> - 2016-10-19 07:24 +0300
  Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-19 07:52 +0000
    Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-19 16:58 -0700
      Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-21 16:01 +1000
        Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-21 00:51 -0700
          Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-21 00:57 -0700
        Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 05:20 -0700
          Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-22 00:25 +1000
            Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 09:13 -0700
              Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-21 16:24 +0000
                Re: 1 /STRING vs SNIP albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-21 20:06 +0200
                Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 14:19 -0700
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-22 13:46 +1000
                Re: 1 /STRING vs SNIP stephen@mpeforth.com (Stephen Pelc) - 2016-10-22 11:34 +0000
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-22 13:49 +0000
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-24 11:15 +1000
                Re: 1 /STRING vs SNIP albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-24 03:01 +0200
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-24 13:29 +1000
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-24 11:15 +0000
                Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-24 19:44 -0700
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-29 11:17 +1000
                Re: 1 /STRING vs SNIP Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-10-29 04:09 -0500
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-29 16:44 +0000
                Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-29 17:11 -0700
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-31 19:11 +1100
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-31 08:47 +0000
      Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 03:49 -0700
        Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-22 20:02 -0700
        Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-22 20:13 -0700
          Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-22 21:09 -0700
            Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-23 18:36 -0700
          Re: 1 /STRING vs SNIP alex <alex@rivadpm.com> - 2016-10-27 14:07 +0100
            Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-27 19:12 -0700
              Re: 1 /STRING vs SNIP alex <alex@rivadpm.com> - 2016-10-28 19:39 +0100
                Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-28 20:26 -0700
    Re: 1 /STRING vs SNIP foxaudioresearch@gmail.com - 2016-10-26 19:52 -0700
      Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-27 09:42 +0000
        Re: 1 /STRING vs SNIP foxaudioresearch@gmail.com - 2016-10-27 06:46 -0700
        Re: 1 /STRING vs SNIP stephen@mpeforth.com (Stephen Pelc) - 2016-10-28 07:31 +0000
          Re: 1 /STRING vs SNIP jim <anon@example.com> - 2016-10-28 11:33 +0100
          Re: 1 /STRING vs SNIP jasmijn Bonting <tessa.bonting@gmail.com> - 2016-10-28 04:09 -0700
            Re: 1 /STRING vs SNIP stephen@mpeforth.com (Stephen Pelc) - 2016-10-28 12:41 +0000
            Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-28 16:50 +0000
              Re: 1 /STRING vs SNIP Chris Curl <ccurl609@gmail.com> - 2016-10-28 10:59 -0700
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-29 10:17 +0000
  Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-19 20:19 +1000
    Re: 1 /STRING vs SNIP foxaudioresearch@gmail.com - 2016-10-19 05:12 -0700
  1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 04:07 -0700
    Re: 1 /STRING vs SNIP albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-21 15:50 +0200
    Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-25 16:38 -0700
      Re: 1 /STRING vs SNIP "David N. Williams" <williams@umich.edu> - 2016-10-26 10:50 -0400
        Re: 1 /STRING vs SNIP "David N. Williams" <williams@umich.edu> - 2016-10-26 10:53 -0400
        Re: 1 /STRING vs SNIP albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-26 17:33 +0200
          Re: 1 /STRING vs SNIP "David N. Williams" <williams@umich.edu> - 2016-10-27 10:16 -0400
            Re: 1 /STRING vs SNIP Doug Hoffman <glidedog@gmail.com> - 2016-10-27 17:01 -0400
          Re: 1 /STRING vs SNIP Coos Haak <htrofhc@gmail.com> - 2016-10-27 17:00 +0200
  Re: 1 /STRING vs SNIP Hans Bezemer <the.beez.speaks@gmail.com> - 2016-10-22 12:25 +0200

csiph-web