Re: NRE committed: PLEASE TEST
- From: "Donal K. Fellows" <donal.k.fellows@xxxxxxxxx>
- Date: Tue, 19 Aug 2008 01:52:53 -0700 (PDT)
john roll wrote:
This is very close and I was trying to formulate something like it
but, well it was hard for me. Is there a reason that you need the
first yield? Why doesn't "coroutine" create the command by default,
why does it wait for the first yield call? Also understand the
reasons for the "iota_1_5" command, as I called it the "token" to hold
the coroutine, but it feels in the way to me (awkward).
Everything's still experimental right now. This is very new after all.
But we can use other features to make this better...
namespace path tcl::unsupported
proc iota {start end} {
for {set i $start} {$i<=$end} {incr i} {yield $i}
return -code break
}
proc UNIQUE_NAME {} {return cor[incr ::COUNTER]}
proc makeIota {start end} {
set cmd [UNIQUE_NAME]
coroutine $cmd apply {args {yield;tailcall {*}$args}} \
iota $start $end
return $cmd
}
I'm not yet 100% satisfied with what I've written, but it does show
how you can wrap the unpleasantness of the current API.
Donal.
.
- Follow-Ups:
- Re: NRE committed: PLEASE TEST
- From: john roll
- Re: NRE committed: PLEASE TEST
- References:
- Re: NRE committed: PLEASE TEST
- From: john roll
- Re: NRE committed: PLEASE TEST
- From: miguel
- Re: NRE committed: PLEASE TEST
- From: john roll
- Re: NRE committed: PLEASE TEST
- Prev by Date: Re: What are some useful tools in profiling where a specific Tcl command is spending time [Was: Re: Regexp vs string match
- Next by Date: free***moves download free
- Previous by thread: Re: NRE committed: PLEASE TEST
- Next by thread: Re: NRE committed: PLEASE TEST
- Index(es):