what's -48 THROW for? (a.k.a. "invalid postpone"). 
Author Message
 what's -48 THROW for? (a.k.a. "invalid postpone").

I did see some sources of a customer who did use postpone in a word
which looks quite innocently.

: ANSI_TO POSTPONE TO ;

and later the word is used as

#MY_CONST ANSI_TO INDEXVAL

now, that's wrong right? Should there be a THROW on executing a
POSTPONE execution when being in exec mode? Or is that THROW
reserved for something completly different...

-- guido
p.s. I've not used this throwcode so far...



Mon, 11 Apr 2005 02:46:00 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").



Quote:
> I did see some sources of a customer who did use postpone in a word
> which looks quite innocently.

> : ANSI_TO POSTPONE TO ;

> and later the word is used as

> #MY_CONST ANSI_TO INDEXVAL

> now, that's wrong right? Should there be a THROW on executing a
> POSTPONE execution when being in exec mode? Or is that THROW
> reserved for something completly different...

> -- guido
> p.s. I've not used this throwcode so far...

I had some room for flags in the headers and added an EXECUTE-ONLY
flag, in an experimental implementation that is.
When trying to POSTPONE [IF] it throws -48.
Not very useful, but sometimes I like to fully implement the standard ;-)

Coos



Mon, 11 Apr 2005 06:17:40 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:

> I did see some sources of a customer who did use postpone in a word
> which looks quite innocently.

> : ANSI_TO POSTPONE TO ;

> and later the word is used as

> #MY_CONST ANSI_TO INDEXVAL

> now, that's wrong right? Should there be a THROW on executing a
> POSTPONE execution when being in exec mode? Or is that THROW
> reserved for something completly different...

    Not necessarily. Since the Standard explicitly says that POSTPONE or
[COMPILE] of TO is ambiguous, you have the following options:

1. POSTPONE checks for words it is forbidden to handle and does a -48
THROW when used to postpone TO.

2. It postpones only the compile part of TO; that part can check the
mode and do a -14 THROW if used as your customer does.

I'm not sure about the most common case (in your example), when it just
postpones TO in toto (and not just the compile part). Can we interpret
the Standard as saying that, since it is an ambiguous condition, any
result is correct, even if it is wrong? ;)

To answer your question, I think that if you use -48 THROW, it should
happen inside ANSI_TO, when POSTPONE refuses to postpone TO. And no, I
have no idea what the intended usage circumstances of -48 THROW are.
-----------------------------------------------------------------------
I want to be a nothing-knower,               Elko Tchernev

for time is dead, the sun is over            www.gl.umbc.edu/~etcher1
and there is nothing left to kill.



Mon, 11 Apr 2005 07:44:35 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:

> I did see some sources of a customer who did use postpone in a word
> which looks quite innocently.

> : ANSI_TO POSTPONE TO ;

> and later the word is used as

> #MY_CONST ANSI_TO INDEXVAL

> now, that's wrong right? Should there be a THROW on executing a
> POSTPONE execution when being in exec mode? Or is that THROW
> reserved for something completly different...

Using POSTPONE with TO is an "ambiguous condition."  It might
be perfectly ok on some systems, but is not guaranteed portable.
If Implementor A regards it as ok, he isn't obligated to do a
THROW, but if Implementor B can't or doesn't wish to support it
he can THROW (or take any other action).

In this case, POSTPONE TO presumably puts the "compilation
semantics" of TO in ANSI-TO, which may make its interpretive
use similarly "ambiguous", but again there is no obligation
to do a THROW or take any other action.

It's equally ambiguous to use IF ... THEN interpretively,
for example, but it's perfectly legal in Open Firmware, which
has extra code to support an interpretive behavior.

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310-491-3356
5155 W. Rosecrans Ave. #1018  Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

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



Mon, 11 Apr 2005 07:46:16 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:


> > I did see some sources of a customer who did use postpone in a word
> > which looks quite innocently.

> > : ANSI_TO POSTPONE TO ;

> > and later the word is used as

> > #MY_CONST ANSI_TO INDEXVAL

> > now, that's wrong right? Should there be a THROW on executing a
> > POSTPONE execution when being in exec mode? Or is that THROW
> > reserved for something completly different...

>...
> To answer your question, I think that if you use -48 THROW, it should
> happen inside ANSI_TO, when POSTPONE refuses to postpone TO. And no, I
> have no idea what the intended usage circumstances of -48 THROW are.

The THROW code assignments in the standard reserve these codes for
the purposes shown.  That definitely does _not_ require implementors
to use those codes, it merely makes standard assignments available
so implementors don't have to invent their own (in the interests of
making as much common usage as possible).

A number of the THROW codes are not practical in use, and probably
have never been used.  Examples include stack overflows (-4 and -6)
and "do-loops nested too deeply during execution" (-7).  Some
folks on the TC were very keen on being thorough, and it seems
harmless enough...

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310-491-3356
5155 W. Rosecrans Ave. #1018  Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

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



Mon, 11 Apr 2005 08:03:42 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:

> I did see some sources of a customer who did use postpone in a word
> which looks quite innocently.

> : ANSI_TO POSTPONE TO ;

> and later the word is used as

> #MY_CONST ANSI_TO INDEXVAL

> now, that's wrong right? Should there be a THROW on executing a
> POSTPONE execution when being in exec mode? Or is that THROW
> reserved for something completly different...

> -- guido
> p.s. I've not used this throwcode so far...

Thanks everyone for your input. To summarize:

(a) the THROW-code is generally used on exec-only words.
(b) many forth system do not care about that leaving room
    for errors in application usage.

In a discussion with collegues it became apparent that
the name "POSTPONE" might have been a bad choice - a name
like "[COMPILES]" might have been better especially for
non-native speakers. Perhaps that's a common reason for
bad usage - people don't recognize it is not intended
that the word will be run immediately as they don't
have much relation to the meaning of "to postpone", and
a technical term be better choice over a temp{*filter*}one.

cheers
-- guido                          <standard disclaimer>



Tue, 12 Apr 2005 00:29:32 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:

> ...
> Thanks everyone for your input. To summarize:

> (a) the THROW-code is generally used on exec-only words.

I think that's an overstatement.  This particular THROW
code is appropriate any time POSTPONE is used with a word
that is not reasonably POSTPONE-able according to the
standard, and the implementation wishes to discourage
that usage.

Quote:
> (b) many forth system do not care about that leaving room
>     for errors in application usage.

A considerable overstatement.  We're talking about
non-portable usage, not necessarily erroneous usage.  A
particular implementation may, for whatever reason,
allow certain behavior even though the standard
identifies it as "ambiguous".

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310-491-3356
5155 W. Rosecrans Ave. #1018  Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

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



Tue, 12 Apr 2005 02:08:03 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:
>A number of the THROW codes are not practical in use, and probably
>have never been used.  Examples include stack overflows (-4 and -6)

These are stack underflows.

On decent OSs, Gforth catches both stack overflows and underflows and
produces the appropriate THROWs.

- 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



Thu, 14 Apr 2005 19:18:27 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:


>> I did see some sources of a customer who did use postpone in a word
>> which looks quite innocently.

>> : ANSI_TO POSTPONE TO ;

>> and later the word is used as

>> #MY_CONST ANSI_TO INDEXVAL

>> now, that's wrong right? Should there be a THROW on executing a
>> POSTPONE execution when being in exec mode?

No, but the system may do it nowadays.  The -48 THROW might be
appropriate when trying to POSTPONE TO (in the definition of ANSI_TO),
though.  However, given the new, pervasive restrictions on compilation
semantics, the ambiguous condition on POSTPONE TO no longer makes any
sense that I see (the problematic case is eliminated by the new
restrictions).

Quote:
>In a discussion with collegues it became apparent that
>the name "POSTPONE" might have been a bad choice - a name
>like "[COMPILES]" might have been better especially for
>non-native speakers.

How about [COMPILE]?  Wait, that exists.  Now, why should

[COMPILES] DROP

mean something other than

[COMPILE] DROP

?

I don't think your proposed name makes anything clearer.

Quote:
> Perhaps that's a common reason for
>bad usage

I think the main reason for the bad usage is thinking about it in the
wrong terms.  POSTPONE is not about immediacy or STATE, so thinking
about it in terms of STATE and IMMEDIATE only makes things complicated
and confusing, which leads to bad usage.  POSTPONE is about
compilation semantics, and while this concept is not completely
orthogonal to IMMEDIATE and STATE, it's certainly not parallel,
either.

BTW, in the code above the problem is with TO, not with POSTPONE.  I
doubt your users have the same problem with

POSTPONE DROP

- 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



Thu, 14 Apr 2005 19:20:59 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:


> >A number of the THROW codes are not practical in use, and probably
> >have never been used.  Examples include stack overflows (-4 and -6)

> These are stack underflows.

> On decent OSs, Gforth catches both stack overflows and underflows and
  ^^^^^^^^^^^^^^
> produces the appropriate THROWs.

I would say that the "decent OSes only" restriction is what makes
these throw codes impractical. Tools that use them (the throw codes)
are unportable.


Thu, 14 Apr 2005 20:15:12 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:



>>>A number of the THROW codes are not practical in use, and probably
>>>have never been used.  Examples include stack overflows (-4 and -6)

>>These are stack underflows.

>>On decent OSs, Gforth catches both stack overflows and underflows and

>   ^^^^^^^^^^^^^^

>>produces the appropriate THROWs.

> I would say that the "decent OSes only" restriction is what makes
> these throw codes impractical. Tools that use them (the throw codes)
> are unportable.

.. which is a problem with any throw-code being not mandatory...


Thu, 14 Apr 2005 23:37:22 GMT  
 what's -48 THROW for? (a.k.a. "invalid postpone").

Quote:



>>>I did see some sources of a customer who did use postpone in a word
>>>which looks quite innocently.

>>>: ANSI_TO POSTPONE TO ;

>>>and later the word is used as

>>>#MY_CONST ANSI_TO INDEXVAL

>>>now, that's wrong right? Should there be a THROW on executing a
>>>POSTPONE execution when being in exec mode?

> No, but the system may do it nowadays.  The -48 THROW might be
> appropriate when trying to POSTPONE TO (in the definition of ANSI_TO),
> though.  However, given the new, pervasive restrictions on compilation
> semantics, the ambiguous condition on POSTPONE TO no longer makes any
> sense that I see (the problematic case is eliminated by the new
> restrictions).

huh? I might have missed that, sorry, there were to many arguments
about postpone and statesmart and the like, sure you know that pfe
uses the traditional scheme of statesmart thingies...

Quote:

>>In a discussion with collegues it became apparent that
>>the name "POSTPONE" might have been a bad choice - a name
>>like "[COMPILES]" might have been better especially for
>>non-native speakers.

> How about [COMPILE]?  Wait, that exists.  Now, why should

> [COMPILES] DROP

> mean something other than

> [COMPILE] DROP

Because the given implementation of ANSI_TO was immediate
and to use [COMPILE] DROP there would do the wrong thing when
used in comp-mode - it would be COMPILE DROP of course and
that differentation was the original reason to introduce
POSTPONE, wasn't it. I do still recommend the usage of
POSTPONE as it has a good abstraction over implementation
details but users just don't get it that it is a newer name
for COMPILE that wraps IMMEDATE words to, and they are
sometimes mislead of seeing an extended [COMPILE] which it
isn't.

- Show quoted text -

Quote:

> ?

> I don't think your proposed name makes anything clearer.

>>Perhaps that's a common reason for
>>bad usage

> I think the main reason for the bad usage is thinking about it in the
> wrong terms.  POSTPONE is not about immediacy or STATE, so thinking
> about it in terms of STATE and IMMEDIATE only makes things complicated
> and confusing, which leads to bad usage.  POSTPONE is about
> compilation semantics, and while this concept is not completely
> orthogonal to IMMEDIATE and STATE, it's certainly not parallel,
> either.

> BTW, in the code above the problem is with TO, not with POSTPONE.  I
> doubt your users have the same problem with

> POSTPONE DROP

the problem was about using a POSTPONE execution in exec-mode and
expecting to get the execution semantics instead of just the
compilation semantics that are specified for POSTPONE to use.


Thu, 14 Apr 2005 23:44:31 GMT  
 
 [ 19 post ]  Go to page: [1] [2]

 Relevant Pages 

1. couldn't load file "example.dll": invalid argument

2. '"""' and linefeed characters

3. "an invalid X"

4. Error 32804 "Invalid IAHandle"

5. wish fatal error: invalid command "html"

6. Invalid command name ""

7. invalid command name "support_init"

8. "invalid argument" during write

9. threaded tcl "alloc: invalid block" errors

10. Error: invalid command name "package"

11. Bug: invalid command name ".tearoff14"

12. invalid command name "else"

 

 
Powered by phpBB® Forum Software