This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Coroutines


On Fri, Jun 16, 2006 at 05:34:41PM -0500, David Nicol wrote:

> On 6/16/06, Dustin Laurence <dustin@laurences.net> wrote:
> >...
> >is. :-)  OTOH if it is possible I'd consider trying to write it, if my
> >GCC-fu ever reaches the requisite level (my rank is somewhere below
> >"pale piece of pigs ear" right now).
> 
> Wow.  How many is that in kyu?

Hmm.  Somewhere between eight thousand and the continuum.  It's hard to
remember after all the beatings.  Still, I hope with enough work I can
get promoted to "beef-smelling big-nosed barbarian" rank and lord it
over the peons. :-)

> I don't have any GCC credibility either but I once got an approving off-list
> reply from Damian Conway while discussing coroutines in the context of
> Perl 6 features -- which had me reading the university library's dusty
> copy of Knuth's Art of Computer Programming

IIRC the problem with Knuth's discussion is it's a bit opaque (quelle
surprise).  Also I think his are symmetric, and I'm afraid I've drunk
the kool-aid in terms of asymmetric ones being simpler and clearer.
However, they should require equivalent magic.

> That said, my thoughts on the question of how to implement coroutines
> using the GCC system are that it would best be done by abandoning the
> idea of using the "native" stack for your program's "logical" stack.
> ...
> Why not implement your stacks as linked lists of dynamically allocated
> stack frame objects, and coerce your language into primitives that
> operate on those objects instead of trying to force things to be C-like?

Hmm.  Very good point.  The biggest problem is probably the lack of
interoperability with C.  I think Lua may do exactly this, come to think
of it, since I think it doesn't allow yields when there is a C function
on the call sequence.

> GCC might not be the best back end for your project.

True.  You can't beat it's market share, though. :-)

> So the other thought, or the rest of the thought, is, why try to force
> your language into GCC when it might be easier to force it into something 
> else?

Well, aside from a possibly irrational fondness for GCC, I guess I
didn't find something that was clearly better.

Dustin

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]