Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.forth > #22396

Re: The current object

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: The current object
Date 2013-05-07 19:00 +0200
Organization 1&1 Internet AG
Message-ID <kmbbuo$jbj$1@online.de> (permalink)
References (19 earlier) <ZL6dnT23hc1-gRvMnZ2dnUVZ_qOdnZ2d@supernews.com> <km6i4p$8ib$1@online.de> <Fc-dnQiRMOoK4hrMnZ2dnUVZ_g6dnZ2d@supernews.com> <km9l2b$dc3$1@online.de> <oZidnXu_lptQIBXMnZ2dnUVZ_rmdnZ2d@supernews.com>

Show all headers | View raw


Andrew Haley wrote:

> Bernd Paysan <bernd.paysan@gmx.de> wrote:
>> Andrew Haley wrote:
>> 
>>> I don't want people to think in the same way.  I want them to be able
>>> to interwork.
>> 
>> Fine with me.  This however means you have to accept that people use
>> various
>> ways to deal with things.  Interwork then means that people can build
>> that stuff on a common base, and deviate where necessary.
> 
> Absolutely, but it's inevitable that some compromise by those with OOP
> systems will be needed.  I don't imagine that interworking can be
> achieved without some compromise on all sides.  I'm trying to find out
> what properties of each OOP system are essential, and which merely
> surface appearance.  (Of course, there is a continuum there; most
> features are somewhere in between.)

Actually, that's not what the common Lispers were after: Their motivation 
was certainly that the syntax and semantics of the pre-MOP-OOPs wouldn't go 
away.

You can't convince anybody to change a larger code base (larger is anything 
beyond a few hundred lines), especially not if the change is inherently bug-
prone.

> It'd be interesting to do some instrumentation at runtime and see what
> proportion of method calls really are polymorphic.

Sure.  Adding such instrumentation is a nice debugging and analysis tool.

> I suppose it is possible for a programmer to be supremely disciplined
> and only use method calls for something that truly is polymorphic and
> use colon definitions for everything else, but I think that this is a
> supreme waste of a programmer's time.  Firstly, you have to plan ahead
> exactly what will be polymorphic.

Not really.  I usually do it that way: Start with non-polymorphic 
definitions.  If I later see I need to change it to polymophic, I insert a 
"method <name>" into the common base class, and be done with it.

What was the discussion about, anyhow?  That methods should be invoked the 
same way as colon definitions?  Without an additional argument?

> Secondly, you have to know in
> advance that some other author subclasing your code won't need a
> polymorphic method.  Thirdly, you have to go back and change colon
> definitions to methods every time you get it wrong.

Yes, but that's not a big issue.  Code is available as source, isn't it?  
Methods and colon definitions are called the same way?  A single "method 
foo" in some base class makes foo a method?

> This is all a lot easier if you are the sole author of a system.

Not really.  If I had fundamentally different calling conventions for 
methods and colon definitions within a class, it would be much more 
difficult to change things after the fact.

>> The CPU's branch predictor would be more dynamic than this code, and
>> when class A and B cluster or have an easy pattern (think e.g. of
>> fixed-size boxes and variable glue boxes interspaced, it's then
>> A/B/A/B/A most of the time), the CPU's branch predictor does a very
>> good job.
> 
> I'm not sure what you mean.  What does this branch perdictor do, and
> which CPU is this?

The indirect branch predictor aka branch target buffer (BTB), available for 
most (if not all) contemporary x86, ARM Cortex A9/A15 CPUs, and a number of 
other, less frequently used CPUs.

The indirect branch predictor transforms goto *something into something like

if(*something = mru) then goto mru; else mru=*something; goto *something;

There's a paper from Kevin Casey, David Gregg, and Anton Ertl, related to 
threaded code VMs, but that also applies to vtables:

http://www.cs.tcd.ie/David.Gregg/papers/toplas05.pdf

To make the BTB work, you absolutely need to inline the method dispatch.  If 
you have monomorphic calls, the BTB predicts perfect.

> Well, I already said that interworking with no alterations is probably
> impossible.  But I have the (dis)advantage of not being attached to
> any existing system.
> 
> I don't think that the OOP systems need to have their own dispatch
> mechanism, though.  A reasonably fast generic mechanism (that suppoert
> even "Smalltalk-style" systems) would work for your system too.  It
> might not be quite as fast, although I think it might well be, but it
> would interwork.

I'm pretty sure that for interworking, we need some sort of adapters, 
because the systems are too different.  It starts with this current object 
thing:  SWOOP e.g. has two modes, one where the methods just use the current 
object, and one where they set the current object by taking the address on 
the top of stack (that's a temporary mode set by any named object, which 
pushes its addess onto the stack, adds the scope of the class' wordlist, and 
changes the mode to an implicit >S S> (>O O> in my terminology) around the 
selector).

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

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


Thread

Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-25 17:56 +0200
  Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-25 11:56 -0500
    Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-26 16:04 +0200
      Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-26 13:02 -0500
        Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-26 21:34 +0200
          Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-26 15:56 -0400
            Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-27 00:48 +0200
              Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-26 18:21 -0500
                Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-28 02:22 +0200
                Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-28 03:31 -0500
                Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-28 06:30 -0400
              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
            Re: Went open source with my GA144 simulator written in Factor Mark Wills <markrobertwills@yahoo.co.uk> - 2013-04-27 00:42 -0700
              Re: Went open source with my GA144 simulator written in Factor albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-27 09:09 +0000
                Re: Went open source with my GA144 simulator written in Factor Mark Wills <markrobertwills@yahoo.co.uk> - 2013-04-27 02:28 -0700
                Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-27 04:52 -0500
                Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-28 02:24 +0200
              Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-27 06:18 -0400
                Re: Went open source with my GA144 simulator written in Factor Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-27 08:06 -0500
              Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-28 07:01 -0400
                Re: Went open source with my GA144 simulator written in Factor albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-28 13:09 +0000
                Re: Went open source with my GA144 simulator written in Factor Doug Hoffman <glidedog@gmail.com> - 2013-04-28 09:33 -0400
                Re: Went open source with my GA144 simulator written in Factor Alex McDonald <blog@rivadpm.com> - 2013-04-28 08:34 -0700
                Re: Went open source with my GA144 simulator written in Factor Alex McDonald <blog@rivadpm.com> - 2013-04-28 08:37 -0700
        Re: Went open source with my GA144 simulator written in Factor Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-30 18:30 +0200

csiph-web