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


Groups > comp.lang.forth > #25161

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 (6 earlier) <2013Aug13.090802@mips.complang.tuwien.ac.at> <nqydnaEtNreKbJTPnZ2dnUVZ_oOdnZ2d@supernews.com> <2013Aug13.114740@mips.complang.tuwien.ac.at> <-M-dnQLR48AWjZfPnZ2dnUVZ_qudnZ2d@supernews.com> <2013Aug13.141852@mips.complang.tuwien.ac.at>
Message-ID <55ednSd0sLUTzJfPnZ2dnUVZ_qCdnZ2d@supernews.com> (permalink)
Date 2013-08-13 10:32 -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:
> 
>>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?

I don't understand why you're asking this question.  You accept, do
you not, that code has to be defensively written to expect
conventionally non-throwing words to throw?

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

OK, I didn't think this is a startling claim.  Consider:

: words-count ( x nt -- x' u ) drop 1+ true ;
: traverse-wordlist  ( xt wid -)
   <walk >r  >r
   begin  2r>  over walk@ ?dup while  2>r  r@ execute  
      while  repeat  then
   drop walk> ;

versus

: count-words ( wid - n)
   <walk  0 swap
   begin  dup walk@ while  swap 1+ swap  repeat
   walk> ;

The advantage of the latter depends on how complex WALK@ is.  WALK@
might be uber-simple in the case of a simply liked list or complex in
the case of a dictionary with hash chains where you wanted words in
definition order.

(Of course, I'm not assuming that you would use <WALK and its friends,
but substitute something of your own with similar functionality.)

Andrew.

Back to comp.lang.forth | Previous | NextPrevious 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