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


Groups > comp.lang.forth > #32141

Re: Reduce dictionary lookups using LIT ?

From "Rod Pemberton" <dont_use_email@xnothavet.cqm>
Newsgroups comp.lang.forth
Subject Re: Reduce dictionary lookups using LIT ?
Date 2014-07-03 03:00 -0400
Organization Aioe.org NNTP Server
Message-ID <op.xietqzse6zenlw@localhost> (permalink)
References <op.xicgra2o6zenlw@localhost> <e5dd3ad4-b6b9-4ece-afca-bf27739c53c8@googlegroups.com>

Show all headers | View raw


On Wed, 02 Jul 2014 04:27:54 -0400, Mark Wills <markwills1970@gmail.com>  
wrote:

> I'd suggest LIT: or AS-LIT or something. I prefer LIT:
>
> : ONE ( -- 1 ) LIT: 1 ;

I found a post by Peter Sovietov in Russian which used # .
He coded one of the online Forth optimizers in Javascript.

I decided to go ahead and just rename LIT as (LIT) .  Apparently,
some Forth-83 systems did this so they could use LIT as above.
And, the updated online version of Leo Brodie's Starting Forth
uses (LITERAL) .  My own dictionary only used LIT twice, once in
LITERAL and once where it shouldn't be, but will be for a while,
until I can remove it, or change another definition.

> The following definition works in my system:
>
> : LIT: ( "n" -- )
>   BL WORD NUMBER ABORT" Not a legal number"
>   COMPILE LIT , ; IMMEDIATE

I don't have ABORT" and I don't recall if my ABORT is exposed,
i.e., in the dictionary, but, yes, the sample I posted works,
at least with COMPILE .

> Your system may use POSTPONE rather than COMPILE.

Yes, I use COMPILE and [COMPILE] even though I have POSTPONE .
It's clear to me as to which operation is being performed.
I only used POSTPONE in the sample because I didn't want
the conversation diversion on why I should use POSTPONE instead.

> But... Is your system so slow that you need this? Rhetorical.
> I'm sure it's not.

No, it's not.  The dictionary is compiled once.

> I question the benefit this would bring...

I was just thinking about if a dictionary or program became
excessively large, doing large searches through the ENTIRE
dictionary, just to NOT find something in the dictionary.
I.e., seemed like an easy change to short-circuit the logic.

> Is this a bootstrapping thing?

No.  My inner interpreter will (still) compile a run-time
LIT and number, if the word is not found in the dictionary.

> You're trying to minimise dictionary lookups [...]

I understood that to be the point of using LIT that way.

> [...] while the system is compiling/bootstrapping itself?

At 3.2Ghz (probably obsolete now...), it isn't really needed.


Rod Pemberton

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


Thread

Reduce dictionary lookups using LIT ? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-01 20:24 -0400
  Re: Reduce dictionary lookups using LIT ? "Elizabeth D. Rather" <erather@forth.com> - 2014-07-01 19:39 -1000
    Re: Reduce dictionary lookups using LIT ? bruce.mcfarling@gmail.com - 2014-07-02 10:30 -0700
      Re: Reduce dictionary lookups using LIT ? "Elizabeth D. Rather" <erather@forth.com> - 2014-07-02 08:53 -1000
      Re: Reduce dictionary lookups using LIT ? Mark Wills <markwills1970@gmail.com> - 2014-07-02 13:47 -0700
        Re: Reduce dictionary lookups using LIT ? BruceMcF <agila61@netscape.net> - 2014-07-02 19:45 -0700
          Re: Reduce dictionary lookups using LIT ? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-07-03 16:56 +0000
            Re: Reduce dictionary lookups using LIT ? bruce.mcfarling@gmail.com - 2014-07-03 10:34 -0700
  Re: Reduce dictionary lookups using LIT ? Mark Wills <markwills1970@gmail.com> - 2014-07-02 01:27 -0700
    Re: Reduce dictionary lookups using LIT ? Bernd Paysan <bernd.paysan@gmx.de> - 2014-07-02 17:11 +0200
      Re: Reduce dictionary lookups using LIT ? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-07-02 16:31 +0000
        Re: Reduce dictionary lookups using LIT ? Bernd Paysan <bernd.paysan@gmx.de> - 2014-07-02 20:32 +0200
      Re: Reduce dictionary lookups using LIT ? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-03 03:01 -0400
        Re: Reduce dictionary lookups using LIT ? "Elizabeth D. Rather" <erather@forth.com> - 2014-07-02 21:42 -1000
        Re: Reduce dictionary lookups using LIT ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-03 16:05 +0000
    Re: Reduce dictionary lookups using LIT ? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-03 03:00 -0400
  Re: Reduce dictionary lookups using LIT ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-02 09:35 +0000
    Re: Reduce dictionary lookups using LIT ? "Elizabeth D. Rather" <erather@forth.com> - 2014-07-02 06:51 -1000
  Re: Reduce dictionary lookups using LIT ? chitselb <chitselb@gmail.com> - 2014-07-02 14:30 -0700
    Re: Reduce dictionary lookups using LIT ? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-03 03:51 -0400
  Re: Reduce dictionary lookups using LIT ? Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2014-07-03 02:41 -0700
    Re: Reduce dictionary lookups using LIT ? "Alex McDonald" <blog@rivadpm.com> - 2014-07-03 11:44 +0100
      Re: Reduce dictionary lookups using LIT ? Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2014-07-03 06:03 -0700
        Re: Reduce dictionary lookups using LIT ? "Alex McDonald" <blog@rivadpm.com> - 2014-07-03 15:16 +0100
          Re: Reduce dictionary lookups using LIT ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-03 16:31 +0000
            Re: Reduce dictionary lookups using LIT ? "Alex McDonald" <blog@rivadpm.com> - 2014-07-03 19:58 +0100
              Re: Reduce dictionary lookups using LIT ? "Alex McDonald" <blog@rivadpm.com> - 2014-07-03 20:02 +0100

csiph-web