Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #22453
| From | Bernd Paysan <bernd.paysan@gmx.de> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: The current object |
| Date | 2013-05-09 00:06 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <kmei8v$s5l$1@online.de> (permalink) |
| References | (13 earlier) <2013May3.185010@mips.complang.tuwien.ac.at> <km3emu$3e3$1@online.de> <518636ef$0$32111$14726298@news.sunsite.dk> <km6j0c$92g$1@online.de> <518a3875$0$32117$14726298@news.sunsite.dk> |
Doug Hoffman wrote:
>>If you
>> treat ivars as you treat methods: unique identifiers of which any object
>> can have any combination. I'm not sure if I want to implement such an
>> OOP system, but it is pretty straight-forward: Just use the same sort of
>> lookup table you use for methods in FMS for ivars. Each class has its
>> individual offset for an ivar.
>>
>> I don't know if that's a good idea to do or not, but it is possible to
>> do.
>
> Have no idea what you mean here.
That's very apparent from the rest of your response: You have a blind spot
there. The problem with common data through common ancestors is a well-
known problem. I try it with another example: Let's take your
rectangle+text. We define a drawable first:
object class drawable
ivar display
ivar drawing-context
ivar x
ivar y \ all drawables have at least a starting point
...
selector draw
selector assign \ generic assignment
end-class
drawable class rectangle
ivar w
ivar h
selector draw
selector area
...
end-class
drawable class text
$var string
selector append
...
end-class
Ok, now we create a text-rectangle. Using standard multi-inheritance tools,
we end up with two displays, two drawing-contexts, and two x/y pairs, which
is not correct - we should have only one of them. However, we have only one
draw and one assign, which is fine.
If we take off our blindfold, and realize that ivars and methods are just
words inside an object context, and that we can use the same implementation
technique which resolves methods in a multiple-inheritance context to
resolve ivars in a multiple-inheritance context, we are done: It now works.
Only one display, only one drawing-context, only one starting point. The
whole thing is "more expensive", but inlining helps a lot.
The whole thing about ivars and methods being "some completely different
animal" is a false dichotomy. For information hiding, you may have "public"
and "private". You always can export an ivar to the outside, using
something like
class foo
ivar x
: &x ( -- addr ) x ;
end-class
so that &x exports the ivar x. What's the difference to making x public? x
is early binding only... but that could be changed. If you want to protect
your ivars (which makes perfectly sense to do!), add some private/public
concept to your OOP system. I did so for BerndOOF, but removed it from the
ANS Forth version, because it didn't make sense in Forth. You need to
access everything through the command line for debugging, so this separation
isn't helpful.
Like many things in Forth, the compiler doesn't enforce good coding style.
And about the separation of data and code, which you find in so many
conventional programming languages ("code is code, and data is data"), in
Forth "data is code" (and in Lisp, "code is data"). Take a variable: That
is a word, which, when executed, returns an address to a data location.
It's code. The only difference from a colon definition is the doer: dovar
instead of docol. The thing you call an ivar is already code: It's an
accessor to the data.
One important difference between Forth and typical mainstream languages is
that Forth is way more malleable. Where's the separation between
implementor and user? Not really... Where's the separation between code
and data? It's not there, either. Data is code, and code is some sort of
data, too; the thing that turns data into code is an "interpreter" of some
sorts.
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-28 06:21 -0400
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-28 15:41 +0200
Re: Went open source with my GA144 simulator written in Factor Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-04-28 16:35 +0200
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-29 02:37 +0200
Re: Went open source with my GA144 simulator written in Factor Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-04-29 10:07 +0200
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-29 21:12 +0200
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-29 06:26 -0400
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-29 21:07 +0200
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-29 22:01 +0200
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-29 16:51 -0400
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-29 23:57 +0200
Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-29 17:24 -0500
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-30 02:16 +0200
Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-30 03:19 -0500
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-29 18:40 -0400
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-29 20:01 -0400
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-30 02:40 +0200
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-05-01 08:58 -0400
Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-01 09:57 -0500
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-05-02 04:24 -0400
Re: Went open source with my GA144 simulator written in Factor Alex McDonald <blog@rivadpm.com> - 2013-05-01 07:58 -0700
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-05-02 04:29 -0400
Re: Went open source with my GA144 simulator written in Factor Alex McDonald <blog@rivadpm.com> - 2013-05-02 02:49 -0700
Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-05-01 08:54 -0400
Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-01 23:59 +0200
Re: Went open source with my GA144 simulator written in Factor Ron Aaron <rambamist@gmail.com> - 2013-04-30 06:05 +0300
The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-01 17:01 +0000
Re: The current object (was: Went open source with my GA144 ...) albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-05-01 19:20 +0000
Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-02 17:02 +0000
Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 02:12 +0200
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-02 04:52 -0400
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-02 04:31 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 18:25 +0200
Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-02 16:58 +0000
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 22:26 +0200
Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-06 14:52 +0000
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 03:47 +0200
Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-07 15:22 +0000
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-02 12:12 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 21:56 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-03 03:19 -0500
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-03 06:54 -0400
Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-02 14:28 +0000
Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 19:58 +0200
Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-03 16:50 +0000
Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-04 18:58 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-04 13:35 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 01:08 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-04 18:29 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 03:00 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-05 03:48 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 23:15 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-06 05:01 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 03:23 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-07 03:39 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 19:00 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-07 13:34 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 22:00 +0200
Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-08 07:26 +0000
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-05 06:39 -0400
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-05 09:15 -0500
Re: The current object Paul Rubin <no.email@nospam.invalid> - 2013-05-05 09:25 -0700
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-05 11:43 -0500
Re: The current object Paul Rubin <no.email@nospam.invalid> - 2013-05-05 09:59 -0700
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-06 05:06 -0500
Re: The current object Mark Wills <forthfreak@gmail.com> - 2013-05-06 00:19 -0700
Re: The current object "WJ" <w_a_x_man@yahoo.com> - 2013-05-13 22:45 +0000
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-05 06:39 -0400
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 23:40 +0200
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-05 06:39 -0400
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 23:29 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-06 05:10 -0500
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-08 07:35 -0400
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-09 00:06 +0200
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-09 06:41 -0400
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-11 21:31 +0200
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-12 07:40 -0400
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-14 01:10 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-14 03:58 -0500
Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-14 14:51 +0000
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-15 03:48 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-14 18:37 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-14 14:42 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-15 00:22 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-15 02:56 -0500
Re: The current object stephenXXX@mpeforth.com (Stephen Pelc) - 2013-05-15 13:52 +0000
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-15 17:58 +0200
Re: The current object albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-05-17 14:01 +0000
Re: The current object johno <email@address.com> - 2013-05-15 22:38 +0100
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-14 06:27 -0400
Re: The current object albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-05-09 16:06 +0000
Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-06 16:12 +0000
Re: The current object (was: Went open source with my GA144 ...) Alex McDonald <blog@rivadpm.com> - 2013-05-06 10:25 -0700
Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 04:00 +0200
Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-07 15:02 +0000
Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 04:09 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-07 03:41 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 19:02 +0200
Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-07 14:33 +0000
Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 19:40 +0200
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-15 16:46 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-15 13:11 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-15 23:23 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-16 02:24 -0500
Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-16 13:55 +0000
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-16 17:45 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 05:13 -0500
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-18 06:43 -0400
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 10:03 -0500
Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-18 11:30 -0400
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-19 01:20 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-19 12:33 -0500
Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-19 01:07 +0200
Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-19 03:58 -0500
OO dispatch (was: The current object) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-16 14:07 +0000
Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 05:28 -0500
Re: OO dispatch anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-20 11:28 +0000
Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-20 09:00 -0500
Re: OO dispatch Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-21 01:37 +0200
Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-21 03:21 -0500
Re: OO dispatch anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-21 12:24 +0000
Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-21 10:18 -0500
Re: OO dispatch anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-21 16:03 +0000
Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-21 12:55 -0500
csiph-web