Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #11576
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Message-not-understood and stack effects |
| Date | 2012-04-24 16:52 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2012Apr24.185248@mips.complang.tuwien.ac.at> (permalink) |
| References | (4 earlier) <MbGdnfJiQpSUlw3SnZ2dnUVZ_sWdnZ2d@supernews.com> <2012Apr20.121722@mips.complang.tuwien.ac.at> <5e4b9d72-5db8-4eb8-871b-0c63a29feecc@m7g2000vbg.googlegroups.com> <2012Apr20.172643@mips.complang.tuwien.ac.at> <da4b6b48-22b6-4e62-ab84-ec07d682a16a@v1g2000yqm.googlegroups.com> |
John Passaniti <john.passaniti@gmail.com> writes:
>On Apr 20, 11:26=A0am, an...@mips.complang.tuwien.ac.at (Anton Ertl)
>wrote:
>> Any OO system veers away from some understanding of
>> explicitness, because it automatically selects the method.
>
>I guess that's one way to view it, but I find that statement very
>strange. In every object system I'm aware of, when you create an
>object (define a class, clone/modify a prototype, insert a delegate,
>etc.) you are *explicitly* defining how you want that object to
>behave.
It's the same with everything I have discussed in this thread.
> When I created that object, I had a
>very explicit understanding of what "draw" would do when I called it
>because that is part of defining the object.
It's the same with the mechanism discussed in this thread, but for
some reason you found it too implicit.
> So saying that the
>object system "automatically selects the method" is weird. When I
>create a deferred word in Forth and and then call it, do you consider
>that in any sense the target word is "automatically selected"?
There is no selection in a deferred word. In an object system, there
is a selection between different methods of a selector. If you don't
find it too implicit, fine. But I wonder why you complained about
implicitness of using the NOT-UNDERSTOOD mechanism for collections.
Everything you wrote above about methods applies there, too.
> When I think of a plain container, I don't
>have any expectation that the container will do anything more than...
>contain. I don't expect that a container will gleefully take messages
>and dispatch them to members. If I want that behavior, I'll
>specialize container to do that.
Then define your containers to behave that way. This thread is
(intended to be) about how you can do that if you want to, in
particular about how to deal with the stack.
>Another principle of Forth is to not speculate about what the
>programmer may want to do with your code. You could sit down and
>write every possible feature in an object system that a programmer
>might want. Or, you could focus on making it simple and fast and
>focused. I fail to see why because you're creating an object system
>that that principle gets tossed aside.
It gets tossed aside from the start. I have found simple OO fragments
(smaller even than mini-OOF) good enough for my Forth programming
(although I occasionally missed tool integration that I might get if
we had a standard OO extension). So if I do more than that, I have
already left the principle above behind.
Others asked for a standard OO thingy for Forth, so I wrote objects.fs
to demonstrate what my ideas are on that, and also to give a useful
library to those who want it. It was used by some, but it did not
take the world by storm (and neither did any other OO extension).
Maybe we don't need a standard OO extension, or maybe we just cannot
find a consensus on one.
Anyway, more recently there has been some discussion on OO in Forth
again, with requests for duck typing and NOT-UNDERSTOOD handling. I had
some ideas how to do that, and I am working them out now.
>Can you show an example of how in your object system you explicitly
>add this dispatch-to-members-of-collection behavior?
It would be something like:
\ addr and len are instance variables
:: not-understood ( i*x1 sel-xt array -- i*x2 )
{: sel-xt :} addr len cells + addr ?do
i @ sel-xt execute
1 cells +loop ;
>Is it one line?
>Many lines? Impossible? If it's not painful for the programmer to
>explicitly add this feature when wanted, then why not let that guide
>your choices instead of speculation about what the programmer may want?
I think you still miss the issue: It's that the NOT-UNDERSTOOD above
works only for selectors with the stack effect ( i*x3 object -- i*x4
). E.g., it does not work for DRAW ( x y object -- ), because it
would consume two stack items in each iteration.
- 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 2011: http://www.euroforth.org/ef11/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-17 13:16 +0000
Re: Message-not-understood and stack effects "A. K." <akk@nospam.org> - 2012-04-17 18:20 +0200
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-17 16:37 +0000
Re: Message-not-understood and stack effects vandys@vsta.org - 2012-04-17 17:43 +0000
Re: Message-not-understood and stack effects Alex McDonald <blog@rivadpm.com> - 2012-04-17 10:40 -0700
Re: Message-not-understood and stack effects Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-17 12:41 -0500
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-18 09:48 +0000
Re: Message-not-understood and stack effects Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-18 05:59 -0500
Re: Message-not-understood and stack effects John Passaniti <john.passaniti@gmail.com> - 2012-04-18 08:52 -0700
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-19 11:47 +0000
Re: Message-not-understood and stack effects Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-19 07:50 -0500
Re: Message-not-understood and stack effects John Passaniti <john.passaniti@gmail.com> - 2012-04-19 07:14 -0700
Re: Message-not-understood and stack effects Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-19 09:31 -0500
Re: Message-not-understood and stack effects Bernd Paysan <bernd.paysan@gmx.de> - 2012-04-19 19:31 +0200
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-20 10:17 +0000
Re: Message-not-understood and stack effects John Passaniti <john.passaniti@gmail.com> - 2012-04-20 07:52 -0700
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-20 15:26 +0000
Re: Message-not-understood and stack effects John Passaniti <john.passaniti@gmail.com> - 2012-04-24 06:09 -0700
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-24 16:52 +0000
Re: Message-not-understood and stack effects John Passaniti <john.passaniti@gmail.com> - 2012-04-28 18:38 -0700
Re: Message-not-understood and stack effects "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-04-29 00:19 -0400
Re: Message-not-understood and stack effects John Passaniti <john.passaniti@gmail.com> - 2012-04-29 11:16 -0700
Re: Message-not-understood and stack effects "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-04-29 21:55 -0400
Re: Message-not-understood and stack effects John Passaniti <john.passaniti@gmail.com> - 2012-05-01 14:44 -0700
Re: Message-not-understood and stack effects "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-05-02 05:35 -0400
Re: Message-not-understood and stack effects Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-02 06:29 -0500
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-02 12:23 +0000
Re: Message-not-understood and stack effects Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-02 08:43 -0500
Re: Message-not-understood and stack effects Doug Hoffman <glidedog@gmail.com> - 2012-05-02 11:06 -0400
Re: Message-not-understood and stack effects Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-03 18:41 +0200
Re: Message-not-understood and stack effects Doug Hoffman <glidedog@gmail.com> - 2012-05-03 13:07 -0400
Re: Message-not-understood and stack effects Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-04 02:46 +0200
Re: Message-not-understood and stack effects Doug Hoffman <glidedog@gmail.com> - 2012-05-03 22:09 -0400
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-03 09:14 +0000
Re: Message-not-understood and stack effects Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-03 04:33 -0500
Re: Message-not-understood and stack effects Mark Wills <markrobertwills@yahoo.co.uk> - 2012-05-02 12:58 -0700
Re: Message-not-understood and stack effects vandys@vsta.org - 2012-05-02 20:43 +0000
Re: Message-not-understood and stack effects Mark Wills <markrobertwills@yahoo.co.uk> - 2012-05-02 13:48 -0700
Re: Message-not-understood and stack effects John Passaniti <john.passaniti@gmail.com> - 2012-05-03 10:42 -0700
TypoForth (was: Message-not-understood and stack effects) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-30 13:47 +0000
Re: TypoForth (was: Message-not-understood and stack effects) BruceMcF <agila61@netscape.net> - 2012-04-30 08:38 -0700
Re: TypoForth (was: Message-not-understood and stack effects) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-30 16:23 +0000
Re: TypoForth (was: Message-not-understood and stack effects) BruceMcF <agila61@netscape.net> - 2012-04-30 09:41 -0700
Re: TypoForth (was: Message-not-understood and stack effects) John Passaniti <john.passaniti@gmail.com> - 2012-05-01 14:53 -0700
Re: Message-not-understood and stack effects anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-21 12:34 +0000
csiph-web