September 15, 2003 Re: Multiple parameter foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Down | "Patrick Down" <pat@codemoon.com> escreveu na mensagem news:Xns93F5E5AAE8BCDpatcodemooncom@63.105.9.61... > "Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in news:bk06c0$2c86$1@digitaldaemon.com: > > > > > Yes, but your solution doesn't work with non-array containers, unless they provide external iteration. If we have a "BinaryTree" and a "Heap" each with a "apply" method, it's useless. > > Yes, but how would Walter implement it? The apply fuction drives the iteration so how would two or more apply fuctions supply parameters to the delegate callback? It would have to be done with coroutines. He's the compiler guy, I'm just the annoying person that keeps asking questions ;) Seriously coroutines is the most simple solution, with a smart compiler most iterator calls can be inlined reducing the performance penalty. Other solution is go the Python or C# way to have a special syntax to create iterators and make them heap objects. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.518 / Virus Database: 316 - Release Date: 12/9/2003 |
September 17, 2003 Re: Multiple parameter foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Yokomiso | "Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in message news:bk46us$1mn5$1@digitaldaemon.com... > Seriously coroutines is the most simple solution, with a smart compiler most > iterator calls can be inlined reducing the performance penalty. Other solution is go the Python or C# way to have a special syntax to create iterators and make them heap objects. I checked into coroutines, and they don't look simple at all to implement :-( |
September 17, 2003 Re: Multiple parameter foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:bk8pnp$pat$2@digitaldaemon.com... > > "Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in message news:bk46us$1mn5$1@digitaldaemon.com... > > Seriously coroutines is the most simple solution, with a smart compiler > most > > iterator calls can be inlined reducing the performance penalty. Other solution is go the Python or C# way to have a special syntax to create iterators and make them heap objects. > > I checked into coroutines, and they don't look simple at all to implement :-( Are we getting tuples instead, or is this basket as hard as coroutines? |
September 17, 2003 Re: Multiple parameter foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk8sgg$t8i$1@digitaldaemon.com... > Are we getting tuples instead, or is this basket as hard as coroutines? You ask for at least one new feature every day! <G> |
September 17, 2003 Re: Multiple parameter foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:bk948l$18uf$1@digitaldaemon.com... > > "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk8sgg$t8i$1@digitaldaemon.com... > > Are we getting tuples instead, or is this basket as hard as coroutines? > > You ask for at least one new feature every day! <G> Then just give me an old one. Just a property that I can call my own ... |
September 17, 2003 Re: Multiple parameter foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> escreveu na mensagem news:bk8pnp$pat$2@digitaldaemon.com... > > "Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in message news:bk46us$1mn5$1@digitaldaemon.com... > > Seriously coroutines is the most simple solution, with a smart compiler > most > > iterator calls can be inlined reducing the performance penalty. Other solution is go the Python or C# way to have a special syntax to create iterators and make them heap objects. > > I checked into coroutines, and they don't look simple at all to implement :-( Hmmm, coroutines are conceptually simple, but there are some very complex implementations. IIRC the coroutine/iterator scheme of Sather was simple, but would introduce some overhead without optimizations (i.e. iterator inlining). As the Sather is GPL'ed you could look at the source code and/or Sather compiler papers. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.518 / Virus Database: 316 - Release Date: 12/9/2003 |
September 17, 2003 Re: Multiple parameter foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | On Tue, 16 Sep 2003 22:00:12 -0700, "Walter" <walter@digitalmars.com> wrote:
>
> "Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in message news:bk46us$1mn5$1@digitaldaemon.com...
> > Seriously coroutines is the most simple solution, with a smart compiler
> most
> > iterator calls can be inlined reducing the performance penalty. Other solution is go the Python or C# way to have a special syntax to create iterators and make them heap objects.
>
> I checked into coroutines, and they don't look simple at all to implement :-(
>
What's so hard? I added coroutines to my language and it was dead simple. I suspect that my definition of couroutine is different than yours, or I am overlooking something important.
|
Copyright © 1999-2021 by the D Language Foundation