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


Groups > comp.lang.forth > #21021

Re: Can i rely on >BODY for anything at all?

Date 2013-03-21 22:07 -1000
From "Elizabeth D. Rather" <erather@forth.com>
Organization FORTH, Inc.
Newsgroups comp.lang.forth
Subject Re: Can i rely on >BODY for anything at all?
References (1 earlier) <kibvaf$sl7$1@speranza.aioe.org> <a054470b-b0b2-4924-9897-e8ffedcc2548@14g2000vbr.googlegroups.com> <kiekir$40r$1@speranza.aioe.org> <a94c69a8-a057-4164-8cbc-6d7b78dffd51@bs5g2000vbb.googlegroups.com> <kih18i$509$1@speranza.aioe.org>
Message-ID <26WdnQwgLPysjNHMnZ2dnUVZ_t-dnZ2d@supernews.com> (permalink)

Show all headers | View raw


On 3/21/13 9:31 PM, Rod Pemberton wrote:
> "Alex McDonald" <blog@rivadpm.com> wrote in message
> news:a94c69a8-a057-4164-8cbc-6d7b78dffd51@bs5g2000vbb.googlegroups.com...
>> On Mar 21, 9:43 am, "Rod Pemberton"
> <do_not_h...@notemailnotq.cpm>
>> wrote:
>>> "Alex McDonald" <b...@rivadpm.com> wrote in message
>
>>>> 2. What would you do with the information, since
>>>
>>>> : foo ( xt -- ) dup iscreated? if >body else ... else what?
>>>
>>> Well, any type of check to make sure >body is not used without
>>> checking if a word is created by using iscreated? etc.
>>>
>>> E.g.,
>>>
>>> : foo ( xt -- ) dup iscreated? if >body "body operations"
>>> then ;
>>>
>>> Or, perhaps,
>>>
>>> : body? ( xt -- a-addr|0 ) dup iscreated? if >body else drop 0
>>> then ;
>>>
>>> : foo ( xt -- ) body? if "body operations" then ;
>>
>> Back to square 1. What now?
>
> 0) How should *I* know what *he* wants to do with >BODY ... ?
> Shouldn't you be asking him?  ;-)
>
> 1) Maybe, he just wants to use it to see how it's used.

Then he can experiment with objects he has defined using CREATE.

> 2) Maybe, he just doesn't want to code potentially unsafe code.

Then he should stick to using it only with objects he has defined 
himself using CREATE.

> 3) Maybe, there is no other way for him to locate the compiled
> part of a Forth definition.

There is nothing that can be done portably with the compiled part of a 
Forth definition.

> 4) Maybe, he hopes to use it for a system word, or for
> self-modifying code.

Self-modifying code is very dangerous practice. In any case, if he's 
working at the system level he should know whether words are defined 
using CREATE in this particular system, and shouldn't have to ask.

> 5) Maybe, he wants to use TO on a word and his TO definition uses
>> BODY.  Therefore, the word must be CREATEd before he can attempt
> to use TO on it.  Perhaps, he wants his code to be portable, so he
> plans to fall-back to another less portable definition if a
>> BODY-based TO isn't available.

TO is a system definition, not a user word. In order to define TO, you 
must know how the objects it's to work on are defined.

> 6) Maybe, he's using it to inspect the content of compiled Forth
> words, i.e., dump, debug, see, or trace, etc.

That is not an appropriate usage of >BODY. >BODY is only guaranteed to 
work with data objects. Any system worth using has its own DUMP, DEBUG, 
etc. If it's your own system, you know how to make this work and don't 
need to ask.

> 7) If the word wasn't CREATEd, then he can't do that.  Try
> something else, or define another word to do what needs to be
> done.

There is no portable way to work with the contents of a colon 
definition, a CONSTANT, or other words not user-defined using CREATE.

> Did you find a reason you like in there?

No.

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

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


Thread

Can i rely on >BODY for anything at all? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-20 01:03 +0000
  Re: Can i rely on >BODY for anything at all? Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-20 02:18 +0100
    Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-20 13:58 +1100
      Re: Can i rely on >BODY for anything at all? Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-19 23:59 -0700
        Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-21 23:17 +1100
          Re: Can i rely on >BODY for anything at all? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-21 07:27 -0500
            Re: Can i rely on >BODY for anything at all? Sieur de Bienville <morrimichael@gmail.com> - 2013-03-21 07:01 -0700
              Re: Can i rely on >BODY for anything at all? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-21 09:14 -0500
                DEFER@ (was: Can i rely on >BODY for anything at all?) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-21 17:31 +0000
                Re: Can i rely on >BODY for anything at all? Sieur de Bienville <morrimichael@gmail.com> - 2013-03-22 14:30 -0700
                Re: Can i rely on >BODY for anything at all? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-23 05:34 -0500
                Re: Can i rely on >BODY for anything at all? Brad Eckert <hwfwguy@gmail.com> - 2013-03-25 09:44 -0700
            Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-22 01:30 +1100
              Re: Can i rely on >BODY for anything at all? Alex McDonald <blog@rivadpm.com> - 2013-03-21 08:17 -0700
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-22 12:14 +1100
                Re: Can i rely on >BODY for anything at all? Alex McDonald <blog@rivadpm.com> - 2013-03-22 03:33 -0700
              Re: Can i rely on >BODY for anything at all? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-21 15:15 -0500
      Re: Can i rely on >BODY for anything at all? Coos Haak <chforth@hccnet.nl> - 2013-03-22 00:24 +0100
        Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-22 11:49 +1100
          Re: Can i rely on >BODY for anything at all? Alex McDonald <blog@rivadpm.com> - 2013-03-22 04:22 -0700
          Re: Can i rely on >BODY for anything at all? Coos Haak <chforth@hccnet.nl> - 2013-03-22 22:38 +0100
            Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-23 21:37 +1100
              Re: Can i rely on >BODY for anything at all? Alex McDonald <blog@rivadpm.com> - 2013-03-23 05:06 -0700
              Re: Can i rely on >BODY for anything at all? Coos Haak <chforth@hccnet.nl> - 2013-03-23 13:18 +0100
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-24 00:17 +1100
                Re: Can i rely on >BODY for anything at all? Coos Haak <chforth@hccnet.nl> - 2013-03-23 15:10 +0100
                Re: Can i rely on >BODY for anything at all? Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-24 01:25 +0100
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-26 12:55 +1100
                Re: Can i rely on >BODY for anything at all? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-26 05:51 -0500
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-28 23:31 +1100
                Re: Can i rely on >BODY for anything at all? stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-28 12:57 +0000
                Re: Can i rely on >BODY for anything at all? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-28 08:15 -0500
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-30 12:56 +1100
                Re: Can i rely on >BODY for anything at all? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-30 04:56 -0500
                Re: Can i rely on >BODY for anything at all? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-30 10:32 +0000
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-04-04 12:36 +1000
                Re: Can i rely on >BODY for anything at all? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-28 17:39 +0000
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-28 21:32 +1100
                Re: Can i rely on >BODY for anything at all? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-28 11:58 +0000
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-29 00:59 +1100
                Re: Can i rely on >BODY for anything at all? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-28 08:41 -1000
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-30 12:43 +1100
                Re: Can i rely on >BODY for anything at all? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-27 17:15 +0000
                Re: Can i rely on >BODY for anything at all? Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-27 22:04 +0100
                Re: Can i rely on >BODY for anything at all? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-28 12:17 +0000
                Re: Can i rely on >BODY for anything at all? "Ed" <invalid@nospam.com> - 2013-03-26 13:13 +1100
                Re: Can i rely on >BODY for anything at all? Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-24 01:21 +0100
    Re: Can i rely on >BODY for anything at all? Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-20 00:01 -0700
      Re: Can i rely on >BODY for anything at all? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-19 22:02 -1000
  Re: Can i rely on >BODY for anything at all? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-20 05:27 -0400
    Re: Can i rely on >BODY for anything at all? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-20 10:27 +0000
      Re: Can i rely on >BODY for anything at all? Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-20 03:23 -0700
        Re: Can i rely on >BODY for anything at all? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-20 17:22 +0000
      Re: Can i rely on >BODY for anything at all? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-20 07:52 -1000
        Re: Can i rely on >BODY for anything at all? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-03-20 18:56 +0000
        OT: SF-translations Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-20 21:44 +0000
          Re: OT: SF-translations Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-20 23:12 +0100
            Re: OT: SF-translations Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-20 22:45 +0000
              Re: OT: SF-translations Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-21 15:50 +0100
          Re: OT: SF-translations "Elizabeth D. Rather" <erather@forth.com> - 2013-03-20 12:38 -1000
        Re: Can i rely on >BODY for anything at all? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-21 05:52 -0400
          Re: Can i rely on >BODY for anything at all? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-21 10:08 +0000
          Re: Can i rely on >BODY for anything at all? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-21 08:17 -1000
            Re: Can i rely on >BODY for anything at all? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-21 18:46 +0000
            Re: Can i rely on >BODY for anything at all? mhx@iae.nl (Marcel Hendrix) - 2013-03-21 20:20 +0200
              Re: Can i rely on >BODY for anything at all? Brad Eckert <hwfwguy@gmail.com> - 2013-03-22 08:41 -0700
                Re: Can i rely on >BODY for anything at all? m.a.m.hendrix@tue.nl - 2013-03-22 09:03 -0700
                Re: Can i rely on >BODY for anything at all? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-22 08:05 -1000
                Re: Can i rely on >BODY for anything at all? Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-22 22:17 +0100
                Re: Can i rely on >BODY for anything at all? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-23 12:07 +0000
                Re: Can i rely on >BODY for anything at all? Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-24 01:40 +0100
                Re: Can i rely on >BODY for anything at all? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-24 03:55 -0500
                Re: Can i rely on >BODY for anything at all? stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-24 12:18 +0000
                Re: Can i rely on >BODY for anything at all? Alex McDonald <blog@rivadpm.com> - 2013-03-24 06:04 -0700
                Re: Can i rely on >BODY for anything at all? Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-24 15:31 +0100
                Re: Can i rely on >BODY for anything at all? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-23 02:26 +0000
                Re: Can i rely on >BODY for anything at all? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-22 17:39 -1000
      Re: Can i rely on >BODY for anything at all? Coos Haak <chforth@hccnet.nl> - 2013-03-20 19:18 +0100
        Re: Can i rely on >BODY for anything at all? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-21 16:18 +0000
          Re: Can i rely on >BODY for anything at all? Coos Haak <chforth@hccnet.nl> - 2013-03-22 00:34 +0100
            Re: Can i rely on >BODY for anything at all? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-21 23:54 +0000
              Re: Can i rely on >BODY for anything at all? Coos Haak <chforth@hccnet.nl> - 2013-03-22 00:54 +0100
              Re: Can i rely on >BODY for anything at all? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-21 14:37 -1000
    Re: Can i rely on >BODY for anything at all? Alex McDonald <blog@rivadpm.com> - 2013-03-20 04:48 -0700
      Re: Can i rely on >BODY for anything at all? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-21 05:43 -0400
        Re: Can i rely on >BODY for anything at all? Alex McDonald <blog@rivadpm.com> - 2013-03-21 08:30 -0700
          Re: Can i rely on >BODY for anything at all? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-22 03:31 -0400
            Re: Can i rely on >BODY for anything at all? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-21 22:07 -1000
            Re: Can i rely on >BODY for anything at all? Alex McDonald <blog@rivadpm.com> - 2013-03-22 03:37 -0700
    Re: Can i rely on >BODY for anything at all? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-20 17:14 +0000

csiph-web