Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: What's righ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 43 Topic 4028 of 4053
Post > Topic >>

Re: What's right with FORTH and wrong with c.l.f.

by Jonah Thomas <jethomas5@[EMAIL PROTECTED] > May 1, 2008 at 09:57 AM

"The Beez'" <hansoft@[EMAIL PROTECTED]
> wrote:

> I've equivalents of Basic string handling (start/count), ZX string
> handling (start/end), but I rarely seem to use them. /STRING. 1-, CHOP
> and BOUNDS are much handier tools in everyday use. And yes, I got
> equivalents for substring replacement and substring deletion as well.
> Parsing files is unmatched in Forth/4tH. Much easier and versatile
> than e.g. C.
 
The weakness I see is concatenating strings. You can use ALLOCATE and
depend on the system that provides ALLOCATE to do decent garbage
collection. Or you can copy both strings at HERE and trust you'll be
able to -ALLOT the space at the right time.

If the point is to send the string to a file or a pipe etc, you don't
have to concatenate strings, just send all the parts in the right order.
You can get by sending the first part as soon as you know it, and then
you don't have to keep track of it. 

If you find a method to do the needed work that's low-overhead for the
hardware (or low overhead for the Forth virtual machine, even if it
isn't the most efficient on the real hardware) then it's likely to wind
up conceptually simple too. Simple methods, simple ideas. It won't be as
easy to use as the string packages that let you do *anything* without
any consideration for how it's done. But it's likely to fit well into
the rest of the Forth toolbox.

Would Forth programmers put up with that? We already do things that need
to be arranged just so, that other languages make easier. Is there any
justification for one more of those?

You can eliminate all stack noise by using locals in every definition.
Put the input parameters into locals. Whenever you generate a stack item
that you don't DROP , put it into a local too. No stack noise at all.
You could get rid of the stack words. Is there any advantage to writing
so the stack is easy to use, when you can get results just as good by
using locals all the time? There's an art to writing Forth so things
mostly appear on the stack when they're needed without much stack noise.
But why go to that trouble when locals will put things wherever you want
with no thought required? Similarly, why accept a simple string package
that requires you to think, when you can have a complicated one that
does everything you want behind your back and gives you results with no
thought required?




 43 Posts in Topic:
What's right with FORTH and wrong with c.l.f.
Richard Owlett <rowlet  2008-04-30 16:14:51 
Re: What's right with FORTH and wrong with c.l.f.
mhx@[EMAIL PROTECTED] (M  2008-05-01 00:00:16 
Re: What's right with FORTH and wrong with c.l.f.
mhx@[EMAIL PROTECTED] (M  2008-05-01 10:54:15 
Re: What's right with FORTH and wrong with c.l.f.
Albert van der Horst <  2008-05-01 14:39:26 
Re: What's right with FORTH and wrong with c.l.f.
mhx@[EMAIL PROTECTED] (M  2008-05-01 10:59:29 
Re: What's right with FORTH and wrong with c.l.f.
Albert van der Horst <  2008-05-01 14:31:31 
Re: What's right with FORTH and wrong with c.l.f.
brian.fox@[EMAIL PROTECTE  2008-04-30 18:14:16 
Re: What's right with FORTH and wrong with c.l.f.
Jonah Thomas <jethomas  2008-05-01 02:58:08 
Re: What's right with FORTH and wrong with c.l.f.
"The Beez'" <  2008-05-01 03:51:29 
Re: What's right with FORTH and wrong with c.l.f.
Jonah Thomas <jethomas  2008-05-01 09:57:10 
string concatenation (was: What's right with FORTH ...)
anton@[EMAIL PROTECTED]   2008-05-01 15:28:43 
Re: string concatenation (was: What's right with FORTH ...)
stephenXXX@[EMAIL PROTECT  2008-05-01 22:53:25 
Re: string concatenation (was: What's right with FORTH ...)
anton@[EMAIL PROTECTED]   2008-05-02 19:02:14 
Re: What's right with FORTH and wrong with c.l.f.
John Passaniti <nntp@[  2008-05-01 22:17:22 
Re: What's right with FORTH and wrong with c.l.f.
Albert van der Horst <  2008-05-01 14:57:46 
Re: What's right with FORTH and wrong with c.l.f.
Bruce McFarling <agila  2008-05-01 13:04:35 
Re: What's right with FORTH and wrong with c.l.f.
Jonah Thomas <jethomas  2008-05-01 18:34:31 
Re: What's right with FORTH and wrong with c.l.f.
Dick van Oudheusden <d  2008-05-02 03:07:49 
Re: What's right with FORTH and wrong with c.l.f.
Richard Owlett <rowlet  2008-05-02 15:58:00 
Re: What's right with FORTH and wrong with c.l.f.
Bruce McFarling <agila  2008-05-02 04:51:55 
Re: What's right with FORTH and wrong with c.l.f.
Aleksej Saushev <asau@  2008-05-02 22:02:30 
Re: What's right with FORTH and wrong with c.l.f.
Marc Olschok <nobody@[  2008-05-02 18:20:38 
Re: What's right with FORTH and wrong with c.l.f.
Aleksej Saushev <asau@  2008-05-03 09:56:47 
Re: What's right with FORTH and wrong with c.l.f.
Marc Olschok <nobody@[  2008-05-03 20:16:22 
Re: What's right with FORTH and wrong with c.l.f.
Aleksej Saushev <asau@  2008-05-04 23:59:26 
Re: What's right with FORTH and wrong with c.l.f.
Marc Olschok <nobody@[  2008-05-05 21:45:18 
Re: What's right with FORTH and wrong with c.l.f.
Aleksej Saushev <asau@  2008-05-07 21:46:15 
Re: What's right with FORTH and wrong with c.l.f.
Marc Olschok <nobody@[  2008-05-12 18:20:59 
Re: What's right with FORTH and wrong with c.l.f.
stephenXXX@[EMAIL PROTECT  2008-05-04 18:46:53 
Re: What's right with FORTH and wrong with c.l.f.
Richard Owlett <rowlet  2008-05-02 16:04:39 
Re: What's right with FORTH and wrong with c.l.f.
Bruce McFarling <agila  2008-05-02 11:45:25 
Re: What's right with FORTH and wrong with c.l.f.
Aleksej Saushev <asau@  2008-05-03 11:44:38 
Re: What's right with FORTH and wrong with c.l.f.
Aleksej Saushev <asau@  2008-05-03 11:57:11 
Re: What's right with FORTH and wrong with c.l.f.
Elizabeth D Rather <er  2008-05-03 07:27:16 
Re: What's right with FORTH and wrong with c.l.f.
Aleksej Saushev <asau@  2008-05-04 23:26:57 
Re: What's right with FORTH and wrong with c.l.f.
John Passaniti <nntp@[  2008-05-05 21:41:12 
Re: What's right with FORTH and wrong with c.l.f.
stephenXXX@[EMAIL PROTECT  2008-05-07 10:16:30 
Re: What's right with FORTH and wrong with c.l.f.
Dick van Oudheusden <d  2008-05-04 03:04:44 
Re: What's right with FORTH and wrong with c.l.f.
Bruce McFarling <agila  2008-05-05 16:35:43 
Re: What's right with FORTH and wrong with c.l.f.
astrobe <fdubois76@[EM  2008-05-07 05:08:02 
Re: What's right with FORTH and wrong with c.l.f.
Alex McDonald <blog@[E  2008-05-07 05:56:35 
Re: What's right with FORTH and wrong with c.l.f.
pml540114@[EMAIL PROTECTE  2008-05-15 06:21:25 
Re: What's right with FORTH and wrong with c.l.f.
Jonah Thomas <jethomas  2008-05-15 21:31:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 5:12:59 CDT 2008.