Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Without life, Biology itself would be impossible.


devel / comp.lang.forth / Re: Another mini-oop

SubjectAuthor
* Another mini-oopDoug Hoffman
+* Re: Another mini-oopNN
|+* Re: Another mini-oopDoug Hoffman
||`* Re: Another mini-oopRuvim
|| `* Re: Another mini-oopDoug Hoffman
||  `* Re: Another mini-oopRuvim
||   `- Re: Another mini-oopDoug Hoffman
|`* Re: Another mini-oopAnton Ertl
| `- Re: Another mini-oopNN
+- Re: Another mini-oopHugh Aguilar
+* Re: Another mini-oopnone
|`* Re: Another mini-oopDoug Hoffman
| `* Re: Another mini-oopdxforth
|  `- Re: Another mini-oopDoug Hoffman
+* Re: Another mini-oopRuvim
|`* Re: Another mini-oopDoug Hoffman
| +* Re: Another mini-oopRuvim
| |`* Re: Another mini-oopDoug Hoffman
| | `* Re: Another mini-oopRuvim
| |  `- Re: Another mini-oopDoug Hoffman
| +* Re: Another mini-oopRuvim
| |`* Re: Another mini-oopDoug Hoffman
| | `* Re: Another mini-oopRuvim
| |  `- Re: Another mini-oopDoug Hoffman
| `* Re: Another mini-oopRuvim
|  +* Re: Another mini-oopDoug Hoffman
|  |+- Re: Another mini-ooppahihu
|  |`- Re: Another mini-oopRuvim
|  `- Re: Another mini-oopDoug Hoffman
+* Re: Another mini-ooppahihu
|`- Re: Another mini-oopDoug Hoffman
`* Re: Another mini-oopluser droog
 +* Re: Another mini-oopluser droog
 |`- Re: Another mini-oopAnton Ertl
 `* Re: Another mini-oopDoug Hoffman
  `* Re: Another mini-oopluser droog
   `* Re: Another mini-oopDoug Hoffman
    +* Re: Another mini-oopluser droog
    |`- Re: Another mini-oopDoug Hoffman
    `- Re: Another mini-oopluser droog

Pages:12
Re: Another mini-oop

<616776fb$0$700$14726298@news.sunsite.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!i2pn.org!usenet.goja.nl.eu.org!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
From: dhoffman...@gmail.com (Doug Hoffman)
Subject: Re: Another mini-oop
Newsgroups: comp.lang.forth
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
<sjuf1e$bbi$1@dont-email.me> <6162e4a6$0$700$14726298@news.sunsite.dk>
<sk7l0u$3u0$1@dont-email.me>
X-Mozilla-News-Host: news://news.sunsite.dk
Date: Wed, 13 Oct 2021 20:16:47 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.14.0
MIME-Version: 1.0
In-Reply-To: <sk7l0u$3u0$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Lines: 100
Message-ID: <616776fb$0$700$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: e67d0ec1.news.sunsite.dk
X-Trace: 1634170619 news.sunsite.dk 700 glidedog@gmail.com/68.55.82.126:55671
X-Complaints-To: staff@sunsite.dk
 by: Doug Hoffman - Thu, 14 Oct 2021 00:16 UTC

On 10/13/21 6:02 PM, Ruvim wrote:
> On 2021-10-10 16:03, Doug Hoffman wrote:
>> On 10/10/21 6:24 AM, Ruvim wrote:
>>> On 2021-09-12 16:19, Doug Hoffman wrote:
>>>> After paring away, the following code would be my idea of a mini-oop
>>>> extension for Forth.
> [...]
>>> The word "var" unconditionally creates a new definition on every use.
>>> So, it shadows the previous definition with the same name. (1)
>>> Probably, such definitions should be local for their classes.
>>
>> mini-OOF does it this way and many seem to like it.
>
> It seems, those many who like it need just a toy.
>
> One of basic OOP features is encapsulation. So it's very unexpected to
> an OOP model to not isolate instance variable accessors of different
> classes from each other (and even from other code out of the classes).
>
> As I can see, a sound OOP model cannot be implemented without utilizing
> namespaces.

I won't disagree. You have seen a version that encapsulates using
wordlist primitives. It would not be hard to incorporate that or maybe
provide encapsulation in some other way that you like.

> By the way, the magnitude of the "state-smartness" problem was
> overestimated. The only problem in this regard is the problem of
> incomplete "postpone", and this problem can be easy solved via a
> standard polyfill.

Ok.

> [...]
>>> Also, you need the class to make an early bound method call.
>
> I mean unification: to do it by providing a class for both early binding
> and accessing another's instance variables.

Anyone could change the mini-oop I show if they want different behavior.

>> Yes, the provided code in the original post of this thread shows how in
>> the example use code. Is it a problem to provide the class when wanting
>> early binding?  e.g., [ point :: draw ]
>> Again, I always get complaints about "too much code" and "it is too
>> complicated". [ point :: draw ] is dead simple to use with very little
>> support code.
>
> It doesn't look like a code that compiles anything.
>
> A better variant:
>
>   [ point ]-> draw
> or
>   [ point ]:: draw
>
> Where
>
>   : ]:: ( cls "name" -- ) ] ' >body swap mfa fm compile, ; immediate
>
> Also it's less likely to be misused.
>
> But switching to interpretation state looks too forced and unnatural in
> any case.

The nice thing is one can change the code in any way one desires.
I chose [ point :: draw ] because it is a "tiny-oop" syntax that has
been seen before in Forth.

>> Here  https://github.com/DouglasBHoffman/FMS2  I use:
>>
>> self  draw  \ late bind
>> eself draw  \ early bind
>
> I also saw "own draw" for early binding in some OOP implementations.
>
>
> But my choice is to use early binding in a simple way (without any
> special things), and use some special things/decorators for late binding
> only. Rationale: late binding is required much less frequently than
> early binding.

Interesting. That is exactly the behavior chosen by the implementers of
Neon(1984). They also accomplished encapsulation without using
wordlists. Andrew McKewan wrote an ANS compatible Neon-like extension
and published it in Forth Dimensions, March 1997. It is very much like
what the Win32Forth people have adopted, I believe. Some have criticized
it for using message-object ordering (and some other things). If you
want to see McKewan's code I could send it to you. I don't have a link,
just the files.

-Doug

> --
> Ruvim

Re: Another mini-oop

<eb41d967-68ed-4987-a409-1b9c9a8f4136n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4044:: with SMTP id i4mr21619032qko.301.1634550967759;
Mon, 18 Oct 2021 02:56:07 -0700 (PDT)
X-Received: by 2002:a37:a046:: with SMTP id j67mr20711182qke.127.1634550967594;
Mon, 18 Oct 2021 02:56:07 -0700 (PDT)
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: Mon, 18 Oct 2021 02:56:07 -0700 (PDT)
In-Reply-To: <616776fb$0$700$14726298@news.sunsite.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=78.131.56.82; posting-account=5cIhGQgAAAD51vWxObfbr2Fz1M5rcgWL
NNTP-Posting-Host: 78.131.56.82
References: <613dfe6e$0$700$14726298@news.sunsite.dk> <sjuf1e$bbi$1@dont-email.me>
<6162e4a6$0$700$14726298@news.sunsite.dk> <sk7l0u$3u0$1@dont-email.me> <616776fb$0$700$14726298@news.sunsite.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <eb41d967-68ed-4987-a409-1b9c9a8f4136n@googlegroups.com>
Subject: Re: Another mini-oop
From: pah...@gmail.com (pahihu)
Injection-Date: Mon, 18 Oct 2021 09:56:07 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 16
 by: pahihu - Mon, 18 Oct 2021 09:56 UTC

Hi,

McKewan's code is on Taygeta:

ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/CLASS10.TXT
ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/CLASS10.ZIP

Regards,
pahihu

Doug Hoffman ezt írta (2021. október 14., csütörtök, 2:17:00 UTC+2):
> If you
> want to see McKewan's code I could send it to you. I don't have a link,
> just the files.
>

Re: Another mini-oop

<616ec1dc$0$697$14726298@news.sunsite.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Tue, 19 Oct 2021 09:02:10 -0400
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0)
Gecko/20100101 Thunderbird/91.1.2
Subject: Re: Another mini-oop
Content-Language: en-US
Newsgroups: comp.lang.forth
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
<sjuf1e$bbi$1@dont-email.me> <6162e4a6$0$700$14726298@news.sunsite.dk>
<sk7l0u$3u0$1@dont-email.me>
From: dhoffman...@gmail.com (Doug Hoffman)
In-Reply-To: <sk7l0u$3u0$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 41
Message-ID: <616ec1dc$0$697$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: b5ede33a.news.sunsite.dk
X-Trace: 1634648540 news.sunsite.dk 697 glidedog@gmail.com/68.55.82.126:54512
X-Complaints-To: staff@sunsite.dk
 by: Doug Hoffman - Tue, 19 Oct 2021 13:02 UTC

On 10/13/21 6:02 PM, Ruvim wrote:
> On 2021-10-10 16:03, Doug Hoffman wrote:

>> Here  https://github.com/DouglasBHoffman/FMS2  I use:
>>
>> self  draw  \ late bind
>> eself draw  \ early bind

> But my choice is to use early binding in a simple way (without any
> special things), and use some special things/decorators for late
> binding only. Rationale: late binding is required much less
> frequently than early binding.

An alternative is to use faster late binding. I have uploaded a virtual
table version of FMS2 to the above github location. Additionally there
is now an early binding syntax: message-to-class. Example:

:class point
cell bytes x
cell bytes y
:m :init ( x y --) y ! x ! ;m
:m :get ( -- x y) x @ y @ ;m
;class

\ instantiate a point object, place it in p2
10 20 point p p value p2

\ default is late bind of :get to contents of p2
: test1 p2 :get .s ;
test1 \ => 10 20

\ force early bind of :get to contents of p2 using message-to-class
: test2 p2 point :get ;
test2 \ => 10 20

Not exactly what you were thinking, but achieving early binding by
using eself and message-to-class seems not complex. Perhaps not even
needed with faster late binding.

-Doug

Re: Another mini-oop

<f7a1d078-f256-442c-937e-1323c0b52cb8n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:5c8:: with SMTP id d8mr1868129qtb.63.1634669410482;
Tue, 19 Oct 2021 11:50:10 -0700 (PDT)
X-Received: by 2002:ae9:d842:: with SMTP id u63mr1535688qkf.44.1634669410318;
Tue, 19 Oct 2021 11:50:10 -0700 (PDT)
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: Tue, 19 Oct 2021 11:50:10 -0700 (PDT)
In-Reply-To: <613dfe6e$0$700$14726298@news.sunsite.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:1110:130:5fb3:bc20:352a:4e1b:e1ca;
posting-account=5cIhGQgAAAD51vWxObfbr2Fz1M5rcgWL
NNTP-Posting-Host: 2a00:1110:130:5fb3:bc20:352a:4e1b:e1ca
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f7a1d078-f256-442c-937e-1323c0b52cb8n@googlegroups.com>
Subject: Re: Another mini-oop
From: pah...@gmail.com (pahihu)
Injection-Date: Tue, 19 Oct 2021 18:50:10 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 51
 by: pahihu - Tue, 19 Oct 2021 18:50 UTC

Doug Hoffman ezt írta (2021. szeptember 12., vasárnap, 15:20:02 UTC+2):
> After paring away, the following code would be my idea of a mini-oop
> extension for Forth. Not a 12 liner, but loc will be recovered quickly
> as classes are written.

Hi,

It is a nice little late-bound thingy, I've played it with a little.

pahihu

: oallot ( cls -- obj) dup dfa @ here swap allot tuck ! ;
: oalloc ( cls -- obj) dup dfa @ allocate throw tuck ! ;
: dynamic ( cls -- obj) oalloc dup >R :init R> ;
0 value supClass
: class ( supClass 'name' -- cls) dup to supClass class ;
: super ( 'name' -- ) ' >body supClass mfa fm compile, ; immediate
: :his ( otherobj 'ivar -- 'otherivar) self - + ;

object
cell var objRefCnt

:m :class ( -- cls ) self @ ;m

:m :className ( -- ca u )
self :class body> >name count ;m

:m :sizeOf ( -- n ) self :class dfa @ ;m

:m :copy ( -- hObj' )
self self :class oalloc tuck self :sizeOf move
dup objRefCnt :his 1 swap ! ;m

:m :equals ( obj -- ) self = ;m

:m :hash ( -- u) self ;m

:m :init ( -- ) 1 objRefCnt ! ;m

:m :free ( -- ) self free throw ;m

:m :retain ( -- ) 1 objRefCnt +! ;m

:m :release ( -- )
-1 objRefCnt +!
objRefCnt @ 0= IF self :free THEN ;m

:m :print ( -- ) self :className type ." @" self h. ;m

drop

Re: Another mini-oop

<616f2cd0$0$700$14726298@news.sunsite.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Tue, 19 Oct 2021 16:38:36 -0400
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0)
Gecko/20100101 Thunderbird/91.1.2
From: dhoffman...@gmail.com (Doug Hoffman)
Subject: Re: Another mini-oop
Newsgroups: comp.lang.forth
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
<f7a1d078-f256-442c-937e-1323c0b52cb8n@googlegroups.com>
Content-Language: en-US
In-Reply-To: <f7a1d078-f256-442c-937e-1323c0b52cb8n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 17
Message-ID: <616f2cd0$0$700$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 73484df8.news.sunsite.dk
X-Trace: 1634675920 news.sunsite.dk 700 glidedog@gmail.com/68.55.82.126:55824
X-Complaints-To: staff@sunsite.dk
 by: Doug Hoffman - Tue, 19 Oct 2021 20:38 UTC

On 10/19/21 2:50 PM, pahihu wrote:

> It is a nice little late-bound thingy, I've played it with a little.

> : oallot ( cls -- obj) dup dfa @ here swap allot tuck ! ;
[..]> : :his ( otherobj 'ivar -- 'otherivar) self - + ;

> object
[..]
> :m :print ( -- ) self :className type ." @" self h. ;m
> drop

Yes. It is simple enough that one can readily customize to make it
do what you want. Linked lists (for late binding) are surprisingly fast.
I think duck typing is a very useful model.

-Doug

Re: Another mini-oop

<skrile$hel$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: Another mini-oop
Date: Thu, 21 Oct 2021 14:24:28 +0300
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <skrile$hel$1@dont-email.me>
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
<sjuf1e$bbi$1@dont-email.me> <6162e4a6$0$700$14726298@news.sunsite.dk>
<sk7l0u$3u0$1@dont-email.me> <616776fb$0$700$14726298@news.sunsite.dk>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 21 Oct 2021 11:24:30 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="fbe8608d00cf3b4b1c0cc48049a24803";
logging-data="17877"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188guPxw4IMYkImWQ8uV7SY"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.2.0
Cancel-Lock: sha1:RBsMB3Lky7PJRAPoyRDqu8U41EA=
In-Reply-To: <616776fb$0$700$14726298@news.sunsite.dk>
Content-Language: en-US
 by: Ruvim - Thu, 21 Oct 2021 11:24 UTC

On 2021-10-14 03:16, Doug Hoffman wrote:
> On 10/13/21 6:02 PM, Ruvim wrote:
>> On 2021-10-10 16:03, Doug Hoffman wrote:
>>> On 10/10/21 6:24 AM, Ruvim wrote:
>>>> On 2021-09-12 16:19, Doug Hoffman wrote:

>> [...]
>>
>> I mean unification: to do it by providing a class for both early
>> binding and accessing another's instance variables.
>
> Anyone could change the mini-oop I show if they want different behavior.
[...]
> The nice thing is one can change the code in any way one desires.

Of course. But it's also true for any open source code.

The only common purpose of distributing/sharing source codes (in Forth)
is to evolve the Forth ecosystem. And one important factor of that is
code reuse in general.

Increasing the number of flavors of the same OOP module makes the
corresponding portability areas (for code reuse) smaller and more
fragmented.

So it's probably better to improve a popular OOP module than create an
incompatible fork of it.

Maybe this mini-oop can be also considered just as a
tutorial/illustration. But then it should be better commented.

[...]
>> But my choice is to use early binding in a simple way (without any
>> special things), and use some special things/decorators for late
>> binding only. Rationale: late binding is required much less frequently
>> than early binding.
>
> Interesting. That is exactly the behavior chosen by the implementers of
> Neon(1984). They also accomplished encapsulation without using
> wordlists. Andrew McKewan wrote an ANS compatible Neon-like extension
> and published it in Forth Dimensions, March 1997. It is very much like
> what the Win32Forth people have adopted, I believe. Some have criticized
> it for using message-object ordering (and some other things). If you
> want to see McKewan's code I could send it to you. I don't have a link,
> just the files.

Yes, I'm interested. I wanted to ask why don't you publish this code on
GitHub for history. But later I saw a post of Pahihu that the code is
already available online at

ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/CLASS10.TXT
ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/CLASS10.ZIP

--
Ruvim

Re: Another mini-oop

<521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:5e4:: with SMTP id z4mr3056927qkg.395.1634957298616;
Fri, 22 Oct 2021 19:48:18 -0700 (PDT)
X-Received: by 2002:a37:a046:: with SMTP id j67mr2990117qke.127.1634957298366;
Fri, 22 Oct 2021 19:48:18 -0700 (PDT)
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: Fri, 22 Oct 2021 19:48:18 -0700 (PDT)
In-Reply-To: <613dfe6e$0$700$14726298@news.sunsite.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=97.87.183.68; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 97.87.183.68
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
Subject: Re: Another mini-oop
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Sat, 23 Oct 2021 02:48:18 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 16
 by: luser droog - Sat, 23 Oct 2021 02:48 UTC

On Sunday, September 12, 2021 at 8:20:02 AM UTC-5, Doug Hoffman wrote:
> After paring away, the following code would be my idea of a mini-oop
> extension for Forth. Not a 12 liner, but loc will be recovered quickly
> as classes are written. Thanks to Bernd Paysan for a couple of ideas:
>
> -Doug
[snip code]

Hi, Doug. Is there any chance you could give a bit of explanation of the code
for me and the other silent noobs in the back row? It seems really cool,
but I just don't get it. Can't seem to shake the PostScript pov that I bring
to my Forth interest.
Like, I understand the "what" if that makes sense. The overall example
of how to use it is clear and easy to follow. But the "what it is doing" part.
That's what I'm having difficulty teasing out as an interested naif.
TIA
--droog

Re: Another mini-oop

<b2abb4a7-26eb-49cb-858e-a0d7d5baac54n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:b045:: with SMTP id z66mr3101460qke.271.1634957484064;
Fri, 22 Oct 2021 19:51:24 -0700 (PDT)
X-Received: by 2002:ae9:dd07:: with SMTP id r7mr3231204qkf.106.1634957483905;
Fri, 22 Oct 2021 19:51:23 -0700 (PDT)
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: Fri, 22 Oct 2021 19:51:23 -0700 (PDT)
In-Reply-To: <521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=97.87.183.68; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 97.87.183.68
References: <613dfe6e$0$700$14726298@news.sunsite.dk> <521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b2abb4a7-26eb-49cb-858e-a0d7d5baac54n@googlegroups.com>
Subject: Re: Another mini-oop
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Sat, 23 Oct 2021 02:51:24 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 20
 by: luser droog - Sat, 23 Oct 2021 02:51 UTC

On Friday, October 22, 2021 at 9:48:19 PM UTC-5, luser droog wrote:
> On Sunday, September 12, 2021 at 8:20:02 AM UTC-5, Doug Hoffman wrote:
> > After paring away, the following code would be my idea of a mini-oop
> > extension for Forth. Not a 12 liner, but loc will be recovered quickly
> > as classes are written. Thanks to Bernd Paysan for a couple of ideas:
> >
> > -Doug
> [snip code]
>
> Hi, Doug. Is there any chance you could give a bit of explanation of the code
> for me and the other silent noobs in the back row? It seems really cool,
> but I just don't get it. Can't seem to shake the PostScript pov that I bring
> to my Forth interest.
> Like, I understand the "what" if that makes sense. The overall example
> of how to use it is clear and easy to follow. But the "what it is doing" part.
> That's what I'm having difficulty teasing out as an interested naif.
> TIA
> --droog

Is there an old post from Bernd Paysan that I should search up for context,
or is that a reference to a private communication?

Re: Another mini-oop

<2021Oct23.101322@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Another mini-oop
Date: Sat, 23 Oct 2021 08:13:22 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 12
Message-ID: <2021Oct23.101322@mips.complang.tuwien.ac.at>
References: <613dfe6e$0$700$14726298@news.sunsite.dk> <521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com> <b2abb4a7-26eb-49cb-858e-a0d7d5baac54n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="646da25659bb81e3912ea511d4515175";
logging-data="23454"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BPThyZIMnESsmfg5cSxYq"
Cancel-Lock: sha1:Pvo/Js9GSQOiQq6HNjGg2m2d5Jo=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 23 Oct 2021 08:13 UTC

luser droog <luser.droog@gmail.com> writes:
>Is there an old post from Bernd Paysan that I should search up for context,
>or is that a reference to a private communication?

<https://bernd-paysan.de/mini-oof.html> may be what you are looking for.

- 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: Another mini-oop

<6173cbd4$0$705$14726298@news.sunsite.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sat, 23 Oct 2021 04:46:09 -0400
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0)
Gecko/20100101 Thunderbird/91.2.0
Subject: Re: Another mini-oop
Content-Language: en-US
Newsgroups: comp.lang.forth
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
<521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
From: dhoffman...@gmail.com (Doug Hoffman)
In-Reply-To: <521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 16
Message-ID: <6173cbd4$0$705$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 1e05806f.news.sunsite.dk
X-Trace: 1634978772 news.sunsite.dk 705 glidedog@gmail.com/68.55.82.126:59382
X-Complaints-To: staff@sunsite.dk
 by: Doug Hoffman - Sat, 23 Oct 2021 08:46 UTC

On 10/22/21 10:48 PM, luser droog wrote:
> On Sunday, September 12, 2021 at 8:20:02 AM UTC-5, Doug Hoffman wrote:
>> After paring away, the following code would be my idea of a mini-oop

> Hi, Doug. Is there any chance you could give a bit of explanation of the code

Read this file and it should explain how the code works:

https://github.com/DouglasBHoffman/FMS2/blob/master/FMS2LL/FMS2LL.f

FMS2LL.f is a more full featured implementation of the same basic oop
engine. If you have any questions after looking at that feel free to ask.

-Doug

Re: Another mini-oop

<e70900c8-5f42-4ef2-ac23-bf4e730d4624n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:ebca:: with SMTP id k10mr88726194qvq.51.1637463721447;
Sat, 20 Nov 2021 19:02:01 -0800 (PST)
X-Received: by 2002:a05:622a:248:: with SMTP id c8mr19713641qtx.248.1637463721267;
Sat, 20 Nov 2021 19:02:01 -0800 (PST)
Path: i2pn2.org!rocksolid2!news.neodome.net!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 19:02:01 -0800 (PST)
In-Reply-To: <6173cbd4$0$705$14726298@news.sunsite.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=97.87.183.68; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 97.87.183.68
References: <613dfe6e$0$700$14726298@news.sunsite.dk> <521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
<6173cbd4$0$705$14726298@news.sunsite.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e70900c8-5f42-4ef2-ac23-bf4e730d4624n@googlegroups.com>
Subject: Re: Another mini-oop
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Sun, 21 Nov 2021 03:02:01 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 21
 by: luser droog - Sun, 21 Nov 2021 03:02 UTC

On Saturday, October 23, 2021 at 3:46:14 AM UTC-5, Doug Hoffman wrote:
> On 10/22/21 10:48 PM, luser droog wrote:
> > On Sunday, September 12, 2021 at 8:20:02 AM UTC-5, Doug Hoffman wrote:
> >> After paring away, the following code would be my idea of a mini-oop
> > Hi, Doug. Is there any chance you could give a bit of explanation of the code
> Read this file and it should explain how the code works:
>
> https://github.com/DouglasBHoffman/FMS2/blob/master/FMS2LL/FMS2LL.f
>
> FMS2LL.f is a more full featured implementation of the same basic oop
> engine. If you have any questions after looking at that feel free to ask.
>
> -Doug

Thanks, guys. I read those. I didn't quite sink in, but then I kinda drifted off into
other stuff. I guess I need to go back to Starting Forth and read the second
half more carefully. I think it's the CREATE ... DOES> that I'm shaky on and that
prevents me from really following the whole thing. So, back to the book, then
those links again, then back to OP. If/when I do that, I will be back with question.
Until then, ... thanks for the help. I'll get there.

--droog

Re: Another mini-oop

<619b91e2$0$700$14726298@news.sunsite.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Mon, 22 Nov 2021 07:49:37 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.2.1
Subject: Re: Another mini-oop
Content-Language: en-US
Newsgroups: comp.lang.forth
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
<521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
<6173cbd4$0$705$14726298@news.sunsite.dk>
<e70900c8-5f42-4ef2-ac23-bf4e730d4624n@googlegroups.com>
From: dhoffman...@gmail.com (Doug Hoffman)
In-Reply-To: <e70900c8-5f42-4ef2-ac23-bf4e730d4624n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 35
Message-ID: <619b91e2$0$700$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 64a26757.news.sunsite.dk
X-Trace: 1637585378 news.sunsite.dk 700 glidedog@gmail.com/68.55.82.126:58581
X-Complaints-To: staff@sunsite.dk
 by: Doug Hoffman - Mon, 22 Nov 2021 12:49 UTC

On 11/20/21 10:02 PM, luser droog wrote:

> I guess I need to go back to Starting Forth and read the second half
> more carefully. I think it's the CREATE ... DOES> that I'm shaky on
> and that prevents me from really following the whole thing. So, back
> to the book,
When I was learning Forth the create...does> penny dropped for me when I
read the 2nd ed. of Starting Forth Chapter 11. Unfortunately the online
versions of SF that I see follow the 1st ed.. In the preface to the 2nd
ed. Brodie says "I've rewritten the explanations of ... defining words
.... which upon re-reading I found somewhat obtuse.

A quick summary using CONSTANT as an example:

A defining word has a time sequence that involves 3 distinct times.

Time 1) Define the defining word CONSTANT
: constant ( n 'name' -- ) create , does> ( -- addr ) @ ;

Time 2) Execute CONSTANT which in turn performs 3 actions
76 constant trombones
Action 1. create a dictionary header with the name trombones
Action 2. comma the value (e.g., 76) from the stack into the
constant's parameter field
Action 3. reset trombone's code pointer field to point to the
code after does>

Time 3) Execute trombones. Since trombones now points to the code
following does>, it fetches the value (76), pushing it
onto the stack. Notice that at Time 3) does> first pushes
onto the stack the child's pfa.

-Doug

Re: Another mini-oop

<f9047fe8-5514-4c8e-b636-852bb53201een@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1883:: with SMTP id v3mr2615525qtc.327.1637720607727;
Tue, 23 Nov 2021 18:23:27 -0800 (PST)
X-Received: by 2002:a05:6214:2a45:: with SMTP id jf5mr2558053qvb.15.1637720607481;
Tue, 23 Nov 2021 18:23:27 -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: Tue, 23 Nov 2021 18:23:27 -0800 (PST)
In-Reply-To: <619b91e2$0$700$14726298@news.sunsite.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=97.87.183.68; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 97.87.183.68
References: <613dfe6e$0$700$14726298@news.sunsite.dk> <521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
<6173cbd4$0$705$14726298@news.sunsite.dk> <e70900c8-5f42-4ef2-ac23-bf4e730d4624n@googlegroups.com>
<619b91e2$0$700$14726298@news.sunsite.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f9047fe8-5514-4c8e-b636-852bb53201een@googlegroups.com>
Subject: Re: Another mini-oop
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Wed, 24 Nov 2021 02:23:27 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 44
 by: luser droog - Wed, 24 Nov 2021 02:23 UTC

On Monday, November 22, 2021 at 6:49:40 AM UTC-6, Doug Hoffman wrote:
> On 11/20/21 10:02 PM, luser droog wrote:
>
> > I guess I need to go back to Starting Forth and read the second half
> > more carefully. I think it's the CREATE ... DOES> that I'm shaky on
> > and that prevents me from really following the whole thing. So, back
> > to the book,
> When I was learning Forth the create...does> penny dropped for me when I
> read the 2nd ed. of Starting Forth Chapter 11. Unfortunately the online
> versions of SF that I see follow the 1st ed.. In the preface to the 2nd
> ed. Brodie says "I've rewritten the explanations of ... defining words
> ... which upon re-reading I found somewhat obtuse.
>
>
> A quick summary using CONSTANT as an example:
>
> A defining word has a time sequence that involves 3 distinct times.
>
> Time 1) Define the defining word CONSTANT
> : constant ( n 'name' -- ) create , does> ( -- addr ) @ ;
>
> Time 2) Execute CONSTANT which in turn performs 3 actions
> 76 constant trombones
> Action 1. create a dictionary header with the name trombones
> Action 2. comma the value (e.g., 76) from the stack into the
> constant's parameter field
> Action 3. reset trombone's code pointer field to point to the
> code after does>
>
> Time 3) Execute trombones. Since trombones now points to the code
> following does>, it fetches the value (76), pushing it
> onto the stack. Notice that at Time 3) does> first pushes
> onto the stack the child's pfa.
>

Hmm. It all seems so simple now (which makes me suspect I've missed
something). Let me see if I can extend it to a pair.

: pair ( x y 'name' -- ) create swap , , does> ( -- addr ) ;
: x @ ;
: y cell + @ ;

Something like that? Hmmm. That's pretty nifty.

Re: Another mini-oop

<19bf21ed-f3c5-43e9-a8e7-661ba8f37e06n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1a8d:: with SMTP id bl13mr2215718qkb.200.1637721004057;
Tue, 23 Nov 2021 18:30:04 -0800 (PST)
X-Received: by 2002:a05:622a:103:: with SMTP id u3mr2760058qtw.187.1637721003850;
Tue, 23 Nov 2021 18:30:03 -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: Tue, 23 Nov 2021 18:30:03 -0800 (PST)
In-Reply-To: <619b91e2$0$700$14726298@news.sunsite.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=97.87.183.68; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 97.87.183.68
References: <613dfe6e$0$700$14726298@news.sunsite.dk> <521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
<6173cbd4$0$705$14726298@news.sunsite.dk> <e70900c8-5f42-4ef2-ac23-bf4e730d4624n@googlegroups.com>
<619b91e2$0$700$14726298@news.sunsite.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <19bf21ed-f3c5-43e9-a8e7-661ba8f37e06n@googlegroups.com>
Subject: Re: Another mini-oop
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Wed, 24 Nov 2021 02:30:04 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 18
 by: luser droog - Wed, 24 Nov 2021 02:30 UTC

On Monday, November 22, 2021 at 6:49:40 AM UTC-6, Doug Hoffman wrote:
> On 11/20/21 10:02 PM, luser droog wrote:
>
> > I guess I need to go back to Starting Forth and read the second half
> > more carefully. I think it's the CREATE ... DOES> that I'm shaky on
> > and that prevents me from really following the whole thing. So, back
> > to the book,
> When I was learning Forth the create...does> penny dropped for me when I
> read the 2nd ed. of Starting Forth Chapter 11. Unfortunately the online
> versions of SF that I see follow the 1st ed.. In the preface to the 2nd
> ed. Brodie says "I've rewritten the explanations of ... defining words
> ... which upon re-reading I found somewhat obtuse.

Aha. Mine's a 1st edition. I like buying "acceptable"-quality used books
in the hope they have fun notes and highlighting.* I might hunt up a 2ed.

*I got really lucky with a copy of Iverson's 1962 APL book. The copy I
got had wrong answers written in (!) and wrong corrections to the
figure references in the text (Iverson got that stuff right the first time).

Re: Another mini-oop

<619dfeca$0$696$14726298@news.sunsite.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Wed, 24 Nov 2021 03:58:50 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.2.1
Subject: Re: Another mini-oop
Content-Language: en-US
Newsgroups: comp.lang.forth
References: <613dfe6e$0$700$14726298@news.sunsite.dk>
<521cbac9-9c8c-4053-8939-0991a6fba23fn@googlegroups.com>
<6173cbd4$0$705$14726298@news.sunsite.dk>
<e70900c8-5f42-4ef2-ac23-bf4e730d4624n@googlegroups.com>
<619b91e2$0$700$14726298@news.sunsite.dk>
<f9047fe8-5514-4c8e-b636-852bb53201een@googlegroups.com>
From: dhoffman...@gmail.com (Doug Hoffman)
In-Reply-To: <f9047fe8-5514-4c8e-b636-852bb53201een@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 29
Message-ID: <619dfeca$0$696$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: f9c399b1.news.sunsite.dk
X-Trace: 1637744330 news.sunsite.dk 696 glidedog@gmail.com/68.55.82.126:59741
X-Complaints-To: staff@sunsite.dk
 by: Doug Hoffman - Wed, 24 Nov 2021 08:58 UTC

On 11/23/21 9:23 PM, luser droog wrote:

> Hmm. It all seems so simple now (which makes me suspect I've missed
> something). Let me see if I can extend it to a pair.
>
> : pair ( x y 'name' -- ) create swap , , does> ( -- addr ) ;
> : x @ ;
> : y cell + @ ;
>
> Something like that?
Actually the following does the same thing:

: pair ( x y 'nam' -- ) create swap , , ;
\ x and y as you have them

If that's what you want it is fine as is. But the real power of create
.... does> is achieved by giving action to the does> part. For example:

: pair' ( x y 'name' -- )
create swap , , does> ( -- x y ) dup @ swap cell+ @ ;

10 20 pair' p1
30 40 pair' p2
p1 . . \ => 20 10
p2 . . \ => 40 30

I may have mislead you with the stack effect in the trombones example.

-Doug

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor