Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #17170

Re: Genral advise and comments on callback style words

From Chris Hinsley <chris.hinsley@gmail.com>
Newsgroups comp.lang.forth
Date 2012-11-08 17:02 +0000
Message-ID <2012110817020085080-chrishinsley@gmailcom> (permalink)
References <2012110713421835115-chrishinsley@gmailcom> <2012Nov7.145519@mips.complang.tuwien.ac.at> <2012110715375130718-chrishinsley@gmailcom> <2012Nov8.173134@mips.complang.tuwien.ac.at>
Subject Re: Genral advise and comments on callback style words

Show all headers | View raw


On 2012-11-08 16:31:34 +0000, Anton Ertl said:

> Chris Hinsley <chris.hinsley@gmail.com> writes:
>>> However, the may thing I want to point out is that in my experience
>>> it's a good idea if the wrapper word (LISTHEAD-ENUMERATE-FORWARDS in
>>> this case) does not keep its data on the data stack during the
>>> callback, and thus allows the caller to pass additional data to the
>>> called-back word
>> 
>> The u paramater here is exactly that ! A user data value, pointer to
>> structure or whatever. It can be used to pass information to the
>> callback or be used by the callback to pass data onto the next callback
>> invocation etc. It's very flexable.
> 
> It's even more flexible if you avoid any internal data on the data
> stack during the callback, because that allows passing an arbitrary
> number of stack elements into and out of the callback, not just one.
> 
> - anton

Yes, but then surely there will just be similar issues with marshalling 
multiple paramaters on the data stack in the callback and an arguement 
for just passing in a structure pointer and letting the callback 
accsess that structure as required ? It all get's tricky to judge the 
best approach, but I have this API used in other projects in C/C++, so 
kind of like the familiarity of how it works.

Chris

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


Thread

Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 13:42 +0000
  Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 13:51 +0000
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 13:56 +0000
  Re: Genral advise and comments on callback style words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-07 13:55 +0000
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:29 +0000
      Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:35 +0000
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:32 +0000
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:37 +0000
      Re: Genral advise and comments on callback style words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-08 16:31 +0000
        Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 17:02 +0000
          Re: Genral advise and comments on callback style words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-08 17:07 +0000
          Re: Genral advise and comments on callback style words Mark Wills <forthfreak@gmail.com> - 2012-11-09 01:16 -0800
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:41 +0000
      Re: Genral advise and comments on callback style words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-08 16:39 +0000
  Re: Genral advise and comments on callback style words Brad Eckert <hwfwguy@gmail.com> - 2012-11-07 08:07 -0800
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 12:52 +0000
  Re: Genral advise and comments on callback style words humptydumpty <ouatubi@gmail.com> - 2012-11-07 13:04 -0800
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 13:04 +0000
      Re: Genral advise and comments on callback style words Mark Wills <forthfreak@gmail.com> - 2012-11-08 06:34 -0800
        Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:40 +0000
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 13:14 +0000
      Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 13:23 +0000
      Re: Genral advise and comments on callback style words Ouatu Bogdan <ouatubi@gmail.com> - 2012-11-08 13:45 +0000
        Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 13:59 +0000
        Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:02 +0000
          Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 15:35 +0000
            Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 16:24 +0000
              Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 16:39 +0000
                Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 16:57 +0000
                Re: Genral advise and comments on callback style words "Elizabeth D. Rather" <erather@forth.com> - 2012-11-08 07:56 -1000
  Re: Genral advise and comments on callback style words Josh Grams <josh@qualdan.com> - 2012-11-08 13:54 +0000
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:06 +0000
      Re: Genral advise and comments on callback style words Josh Grams <josh@qualdan.com> - 2012-11-08 18:04 +0000
        Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 19:36 +0000
        Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 19:38 +0000
          Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 19:42 +0000
    Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:11 +0000
      Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:31 +0000
        Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:51 +0000
          Re: Genral advise and comments on callback style words Josh Grams <josh@qualdan.com> - 2012-11-08 18:23 +0000
            Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 19:57 +0000
            Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 20:04 +0000
              Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 20:17 +0000
                Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 20:29 +0000
                Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 20:50 +0000

csiph-web