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


Groups > comp.lang.forth > #25154

Re: Adding NTs or making XTs the only opaque Forth type

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Adding NTs or making XTs the only opaque Forth type
Date 2013-08-13 12:18 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2013Aug13.141852@mips.complang.tuwien.ac.at> (permalink)
References (5 earlier) <8rmdnaeXSvR6g5TPnZ2dnUVZ_qGdnZ2d@supernews.com> <2013Aug13.090802@mips.complang.tuwien.ac.at> <nqydnaEtNreKbJTPnZ2dnUVZ_oOdnZ2d@supernews.com> <2013Aug13.114740@mips.complang.tuwien.ac.at> <-M-dnQLR48AWjZfPnZ2dnUVZ_qudnZ2d@supernews.com>

Show all headers | View raw


Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>>>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>>>> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>>>>>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>>>>>> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>>>>>>>>: count-words ( wid - n)   
>>>>>>>>>   <walk  0 swap
>>>>>>>>>   begin  dup walk@ while  swap 1+ swap  repeat
>>>>>>>>>   walk> ;
...
>>>> If it is no big deal, why is there no code example?
>>>
>>>Because it's a trivial change:
>>>
>>>: traverse-wordlist  ( xt wid -)
>>>   <walk >r  >r
>>>   begin  2r>  over walk@ while
>>>     2>r  r@ catch  ?dup if  2r> drop walk>  throw  then
>>>   repeat
>>>   drop walk> ;
>> 
>> For this particular example, it's a small change, but for e.g.,
>> COUNT-WORDS it's larger. 
>
>COUNT-WORDS cannot throw on any standard system.
>
>> Or is <WALK etc. only good for implementing
>> TRAVERSE-WORDLIST?
>
>You asked for an example.  You got one.  It didn't make your point for
>you, so you demand another.

Ok, it's as I thought.  It's really only good for implementing
TRAVERSE-WORDLIST.

>> Standard Forth systems are allowed to convert ^C into an exception,
>
>I don't think so.  You have argued in the past that anything which is
>not stated in the description of a word's behaviour is forbidden: see
>our discussion of whether a task can assume that a block buffer can
>safely be used as scratch memory as long as you don't UPDATE .  I
>accepted that, within the letter of the law, you were right: what is
>not prescribed is forbidden.  This is, I believe, the usual way to
>intepret ISO standards.

That's a good point.  I don't see provision for allowing to convert a
user interrupt or stack overflow or underflow into the corresponding
exception in the standard.

In the meantime, there are systems (such as Gforth and SwiftForth)
that actually do convert these exceptions.  And since IMO that's a
good idea, I think the absence of this provision is a hole in the
standard.

>Sure, but it's not certainly clear that, say, DUP can throw an
>exception.  My opinion is that it cannot and must not because it would
>break standard Forth code in libraries.

Which library is broken, in which way?

>  This behaviour is only OK in
>code that has been specially written to expect it.  So, if you want
>this behaviour in your system and you want to be able to use libraries
>you have to provide a standard-compatible mode for those libraries. 

Gforth actually has --die-on-signal, although that was not designed
for the purpose you present here.  But if you really prefer that, you
are welcome to use it.  To give an idea of the consequences:

[~:80070] gforth
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
dup 
:1: Stack underflow
>>>dup<<<
Backtrace:
bye 
[~:80071] gforth --die-on-signal
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
dup 

Segmentation fault.
[~:80072]

>>>>>Perhaps not, but it does explain it.  Passing an XT is very well-
>>>>>suited to that task, less so to this one.  The reason is that in this
>>>>>case, the XT is executed many times, making it a significant burden in
>>>>>simple cases.
>>>> 
>>>> What do you mean with "burden"?  
>>>
>>>Effort.  Time.  Power.  Y'know, the stuff we try to minimize.
>> 
>> We try to minimize a variety of metrics, several of which are "time"
>> metrics.  My question was which metric you actually meant.  Or
>> better, present some numbers to support your claim.
>
>Why?  You've done nothing.  It's easy to demand of everyone else what
>you don't do yourself.

You claimed "a significant burden", so it's up to you to support this
claim.

- 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
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2013: http://www.euroforth.org/ef13/

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


Thread

Adding NTs or making XTs the only opaque Forth type "Alex McDonald" <blog@rivadpm.com> - 2013-08-05 21:11 +0100
  Re: Adding NTs or making XTs the only opaque Forth type anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-06 07:01 +0000
    Re: Adding NTs or making XTs the only opaque Forth type stephenXXX@mpeforth.com (Stephen Pelc) - 2013-08-06 16:10 +0000
      Re: Adding NTs or making XTs the only opaque Forth type Bernd Paysan <bernd.paysan@gmx.de> - 2013-08-06 22:22 +0200
  Re: Adding NTs or making XTs the only opaque Forth type stephenXXX@mpeforth.com (Stephen Pelc) - 2013-08-06 15:54 +0000
    Re: Adding NTs or making XTs the only opaque Forth type albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-08-06 17:43 +0000
      Re: Adding NTs or making XTs the only opaque Forth type "Elizabeth D. Rather" <erather@forth.com> - 2013-08-06 13:16 -1000
        Re: Adding NTs or making XTs the only opaque Forth type "Elizabeth D. Rather" <erather@forth.com> - 2013-08-06 13:55 -1000
        Re: Adding NTs or making XTs the only opaque Forth type Bernd Paysan <bernd.paysan@gmx.de> - 2013-08-07 02:33 +0200
          Re: Adding NTs or making XTs the only opaque Forth type "Alex McDonald" <blog@rivadpm.com> - 2013-08-07 16:29 +0100
            Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-07 10:54 -0500
              Re: Adding NTs or making XTs the only opaque Forth type "Alex McDonald" <blog@rivadpm.com> - 2013-08-07 17:10 +0100
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-07 12:06 -0500
                Re: Adding NTs or making XTs the only opaque Forth type "Alex McDonald" <blog@rivadpm.com> - 2013-08-07 18:43 +0100
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-07 12:47 -0500
                Re: Adding NTs or making XTs the only opaque Forth type "Alex McDonald" <blog@rivadpm.com> - 2013-08-07 19:14 +0100
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-07 15:13 -0500
                Re: Adding NTs or making XTs the only opaque Forth type "Alex McDonald" <blog@rivadpm.com> - 2013-08-07 23:09 +0100
                Re: Adding NTs or making XTs the only opaque Forth type anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-08 13:45 +0000
                Re: Adding NTs or making XTs the only opaque Forth type "Alex McDonald" <blog@rivadpm.com> - 2013-08-08 15:41 +0100
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-08 10:29 -0500
                Re: Adding NTs or making XTs the only opaque Forth type anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-08 16:15 +0000
                Re: Adding NTs or making XTs the only opaque Forth type Bernd Paysan <bernd.paysan@gmx.de> - 2013-08-08 19:25 +0200
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-08 14:05 -0500
                Re: Adding NTs or making XTs the only opaque Forth type anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-12 16:28 +0000
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-12 12:44 -0500
                Re: Adding NTs or making XTs the only opaque Forth type anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-13 07:08 +0000
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-13 03:40 -0500
                Re: Adding NTs or making XTs the only opaque Forth type anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-13 09:47 +0000
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-13 05:55 -0500
                Re: Adding NTs or making XTs the only opaque Forth type anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-13 12:18 +0000
                Re: Adding NTs or making XTs the only opaque Forth type Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-13 10:32 -0500

csiph-web