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


Groups > comp.lang.forth > #25150

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

From Andrew Haley <andrew29@littlepinkcloud.invalid>
Subject Re: Adding NTs or making XTs the only opaque Forth type
Newsgroups comp.lang.forth
References (7 earlier) <2013Aug12.182851@mips.complang.tuwien.ac.at> <8rmdnaeXSvR6g5TPnZ2dnUVZ_qGdnZ2d@supernews.com> <2013Aug13.090802@mips.complang.tuwien.ac.at> <nqydnaEtNreKbJTPnZ2dnUVZ_oOdnZ2d@supernews.com> <2013Aug13.114740@mips.complang.tuwien.ac.at>
Message-ID <-M-dnQLR48AWjZfPnZ2dnUVZ_qudnZ2d@supernews.com> (permalink)
Date 2013-08-13 05:55 -0500

Show all headers | View raw


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> ;
>>>>>>> 
>>>>>>> Interesting.  What happens if a THROW happens between <WALK and WALK>?
>>>>>>
>>>>>>It's up to the programmer: if contents of the loop can THROW, then you
>>>>>>have to CATCH it.  I don't know how common that would be, but it's no
>>>>>>big deal if it happens.
>>>>> 
>>>>> If it is no big deal, who is there no code example?
>>>>
>>>>Pardon?
>>> 
>>> 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.
 
>>>>But usually you don't need to handle exceptions.  So why burden an
>>>>example with it?
>>> 
>>> I usually need to handle exceptions, e.g., the user pressing ^C.
>>
>>Sure, but this is nothing to do with standard Forth.
> 
> 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.

You don't get to have one rule for compliance when it suits you, and
one for everyone else.

> and the standard even provides an exception number for that.

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.  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. 

>>>>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.

Andrew.

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