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: Bernd Paysan
Subject: Re: [gforth] two alternative definitions for <string.fs>
Date: Sat, 09 Nov 2013 22:23:09 +0100
User-agent: KMail/4.10.5 (Linux/3.7.10-1.16-desktop; KDE/4.10.5; x86_64; ; )

Am Samstag, 9. November 2013, 14:53:39 schrieb Marcos Cruz:
> 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?

This causes troubles with creating an image.  The dynamically allocated memory 
isn't saved in the image.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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