gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] two alternative definitions for <string.fs>


From: Marcos Cruz
Subject: Re: [gforth] two alternative definitions for <string.fs>
Date: Sat, 9 Nov 2013 14:53:39 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

En/Je/On 2013-11-08 18:18, Bernd Paysan escribió / skribis / wrote :

> I've added a few more of those checks to the git HEAD version, so that
> $+! on an uninitialized string works, too.  Or $del/$ins.

I didn't redefine them because I didn't need them. But that makes me
think of the speed penalty.  It could be noticeable in some
applications.

Anyway, since the problem is the first fetch fails if the variable has
not been initialized, it seems better to initialize it by default than
to check every time if it has been initialized or not.  Besides, Gforth
initializes ordinary variables.

I think something like this could be a simpler and better alternative:

  : $variable  ( "name" -- )
    variable  pad 0 latestxt execute $!
    ;

Beside, it makes the definitions more legible.

What do you think?

-- 
Marcos Cruz
http://programandala.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]