Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Forty two.


devel / comp.lang.forth / Re: Multiple DOES>

SubjectAuthor
* Multiple DOES>Nickolay Kolchin
`* Re: Multiple DOES>Anton Ertl
 `- Re: Multiple DOES>Nickolay Kolchin

1
Multiple DOES>

<70bc2a5d-59f9-418e-8cb3-a55d1409483fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15300&group=comp.lang.forth#15300

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:21ea:: with SMTP id p10mr84691222qvj.67.1637420270569;
Sat, 20 Nov 2021 06:57:50 -0800 (PST)
X-Received: by 2002:ad4:4f0a:: with SMTP id fb10mr85067076qvb.40.1637420270407;
Sat, 20 Nov 2021 06:57:50 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 20 Nov 2021 06:57:50 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <70bc2a5d-59f9-418e-8cb3-a55d1409483fn@googlegroups.com>
Subject: Multiple DOES>
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Sat, 20 Nov 2021 14:57:50 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 4
 by: Nickolay Kolchin - Sat, 20 Nov 2021 14:57 UTC

Can anybody provide examples of meaningful use of double DOES> ? I.e. when we have several in word definition:

: T CREATE DOES> DROP 1 DOES> DROP 2 DOES> DROP 3 ;

I always thought that this behaviour was not intended, but just a side effect of concrete implementation.

Re: Multiple DOES>

<2021Nov20.173029@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15302&group=comp.lang.forth#15302

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Multiple DOES>
Date: Sat, 20 Nov 2021 16:30:29 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 51
Message-ID: <2021Nov20.173029@mips.complang.tuwien.ac.at>
References: <70bc2a5d-59f9-418e-8cb3-a55d1409483fn@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="4419d90528b29b65bdb3060a96596e03";
logging-data="10442"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jus1jsCtdOVSFpuaKOIVu"
Cancel-Lock: sha1:vHz993h4oh8n+tnn6ZY4dbXBAtM=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 20 Nov 2021 16:30 UTC

Nickolay Kolchin <nbkolchin@gmail.com> writes:
>Can anybody provide examples of meaningful use of double DOES> ?
>I.e. when we have several in word definition:
>
>: T CREATE DOES> DROP 1 DOES> DROP 2 DOES> DROP 3 ;

Looking at
<https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Advanced-does_003e-usage-example.html>, you can see the word

: define-format ( disasm-xt table-xt -- )
\ define an instruction format that uses disasm-xt for
\ disassembling and enters the defined instructions into table
\ table-xt
create 2,
does> ( u "inst" -- )
\ defines an anonymous word for disassembling instruction inst,
\ and enters it as u-th entry into table-xt
2@ swap here name string, ( u table-xt disasm-xt c-addr ) \ remember string
noname create 2, \ define anonymous word
execute latestxt swap ! \ enter xt of defined word into table-xt
does> ( addr w -- )
\ disassemble instruction w at addr
2@ >r ( addr w disasm-xt R: c-addr )
execute ( R: c-addr ) \ disassemble operands
r> count type ; \ print name

But note that here the second does> works on a word defined by the
first does>, not on the same word the first does> worked on.

If you are thinking of overriding one DOES> of a CREATEd word with
another DOES>, I only know of contrived examples. The reason is that
overriding works only on the most recently defined word (which has to
be CREATEd).

Some flash-based systems have decided to only support using DOES> once
(some requiring <BUILDS instead of CREATE).

>I always thought that this behaviour was not intended, but just a side effect of concrete implementation.

It's also a side effect of the two-step interface (that's why the
standard standardized overriding; the alternative would have been to
specify yet another ambiguous condition). If the CREATE step and the
DOES> step were performed in one go by the same word, overriding would
not be possible.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Multiple DOES>

<b282f4a3-cd7e-4d02-9595-085f320da736n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15303&group=comp.lang.forth#15303

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:270e:: with SMTP id b14mr3996382qkp.475.1637430988511;
Sat, 20 Nov 2021 09:56:28 -0800 (PST)
X-Received: by 2002:a05:622a:103:: with SMTP id u3mr16747981qtw.187.1637430988324;
Sat, 20 Nov 2021 09:56:28 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 20 Nov 2021 09:56:28 -0800 (PST)
In-Reply-To: <2021Nov20.173029@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=213.21.29.203; posting-account=DoM31goAAADuzlbg5XKrMFannjkYS2Lr
NNTP-Posting-Host: 213.21.29.203
References: <70bc2a5d-59f9-418e-8cb3-a55d1409483fn@googlegroups.com> <2021Nov20.173029@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b282f4a3-cd7e-4d02-9595-085f320da736n@googlegroups.com>
Subject: Re: Multiple DOES>
From: nbkolc...@gmail.com (Nickolay Kolchin)
Injection-Date: Sat, 20 Nov 2021 17:56:28 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 50
 by: Nickolay Kolchin - Sat, 20 Nov 2021 17:56 UTC

On Saturday, November 20, 2021 at 7:47:37 PM UTC+3, Anton Ertl wrote:
> Nickolay Kolchin <nbko...@gmail.com> writes:
> >Can anybody provide examples of meaningful use of double DOES> ?
> >I.e. when we have several in word definition:
> >
> >: T CREATE DOES> DROP 1 DOES> DROP 2 DOES> DROP 3 ;
> Looking at
> <https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Advanced-does_003e-usage-example.html>, you can see the word
>
> : define-format ( disasm-xt table-xt -- )
> \ define an instruction format that uses disasm-xt for
> \ disassembling and enters the defined instructions into table
> \ table-xt
> create 2,
> does> ( u "inst" -- )
> \ defines an anonymous word for disassembling instruction inst,
> \ and enters it as u-th entry into table-xt
> 2@ swap here name string, ( u table-xt disasm-xt c-addr ) \ remember string
> noname create 2, \ define anonymous word
> execute latestxt swap ! \ enter xt of defined word into table-xt
> does> ( addr w -- )
> \ disassemble instruction w at addr
> 2@ >r ( addr w disasm-xt R: c-addr )
> execute ( R: c-addr ) \ disassemble operands
> r> count type ; \ print name
>
> But note that here the second does> works on a word defined by the
> first does>, not on the same word the first does> worked on.
>
> If you are thinking of overriding one DOES> of a CREATEd word with
> another DOES>, I only know of contrived examples. The reason is that
> overriding works only on the most recently defined word (which has to
> be CREATEd).
>
> Some flash-based systems have decided to only support using DOES> once
> (some requiring <BUILDS instead of CREATE).
> >I always thought that this behaviour was not intended, but just a side effect of concrete implementation.
> It's also a side effect of the two-step interface (that's why the
> standard standardized overriding; the alternative would have been to
> specify yet another ambiguous condition). If the CREATE step and the
> DOES> step were performed in one go by the same word, overriding would
> not be possible.
>
> - anton
> --
> M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
> comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
> New standard: http://www.forth200x.org/forth200x.html
> EuroForth 2021: https://euro.theforth.net/2021

Thank you. That makes sense.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor