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


Groups > comp.lang.forth > #4641

Re: factoring exercise

From Julian Fondren <ayrnieu@gmail.com>
Newsgroups comp.lang.forth
Subject Re: factoring exercise
Date 2011-08-07 13:53 -0500
Organization A noiseless patient Spider
Message-ID <86d3gh3vg2.fsf@gmail.com> (permalink)
References <44ea6cbf-3e3a-4a65-beb3-b4b3f70b2f07@fq4g2000vbb.googlegroups.com> <117106f5-99ee-46bd-958b-d9d63e8d147e@w24g2000yqw.googlegroups.com> <1bcfe8e4-26c4-485f-99c6-556939b6ded5@glegroupsg2000goo.googlegroups.com>

Show all headers | View raw


"arc@vorsicht-bissig.de" <arc@vorsicht-bissig.de> writes:

> Hey, thanks for your post, I found it interesting, especially as I've got a vaguely similar case on my hands, which I might post in the next day or so. 
>
> i was particularly intrigued by this option: 
>
> On Saturday, 30 July 2011 18:19:33 UTC+12, Julian Fondren  wrote:
>
>
>> 
>>   : later  r> r> 2>r ;
>>   : (x>flag) ( cfa x1 -- xt x2 )
>>     dup restrict-mask and    if drop -3 else
>>     over interpret/compile?  if drop later @ -2 exit else
>>     dup immediate-mask and   if drop -1 else
>>                                 drop 0 then then then r>drop ;
>> 
>>   : x>iflag  (x>flag) interpret/compile-int ;
>>   : x>cflag  (x>flag) interpret/compile-comp ;
>> 
>
> took me a few minutes of thought to work out what LATER is doing, particularly as i momentarily forgot that the first thing on the return stack would be LATER's own context. 
>
> it's sort of like a restricted version of COME FROM, isn't it?

I couldn't say.  I remember thinking these words similar to uses of
call/cc in Scheme.

> Doesn't this sort of thing introduce the worry that the flow of control becomes difficult to understand? 

Sure. This option, and the prior one with the STATE variable, weren't
all that serious.  Although if you were already familiar with LATER you
wouldn't've needed any minutes of thought to work out what it was doing
-- you wouldn't look at LATER itself, but at (X>FLAG) and its callers,
which are... only about as muddled as in the first option.

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


Thread

factoring exercise m_l_g3 <m_l_g3@yahoo.com> - 2011-07-28 12:22 -0700
  Re: factoring exercise Hugh Aguilar <hughaguilar96@yahoo.com> - 2011-07-29 16:14 -0700
    Re: factoring exercise mlg3 <m_l_g3@yahoo.com> - 2011-08-03 01:36 +0400
      Re: factoring exercise Julian Fondren <ayrnieu@gmail.com> - 2011-08-02 17:25 -0500
        Re: factoring exercise mlg3 <m_l_g3@yahoo.com> - 2011-08-03 23:19 +0400
  Re: factoring exercise Julian Fondren <ayrnieu@gmail.com> - 2011-07-29 23:19 -0700
    Re: factoring exercise Julian Fondren <ayrnieu@gmail.com> - 2011-07-30 02:45 -0500
      Re: factoring exercise arc <arc@vorsicht-bissig.de> - 2011-08-09 10:47 +0000
    Re: factoring exercise "arc@vorsicht-bissig.de" <arc@vorsicht-bissig.de> - 2011-08-07 03:11 -0700
      Re: factoring exercise Julian Fondren <ayrnieu@gmail.com> - 2011-08-07 13:53 -0500
  Re: factoring exercise Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-07-30 02:14 -0500
  Re: factoring exercise Hugh Aguilar <hughaguilar96@yahoo.com> - 2011-08-01 21:03 -0700

csiph-web