[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rfc: (ice-9 accumulate)
From: |
Andy Wingo |
Subject: |
Re: rfc: (ice-9 accumulate) |
Date: |
Sat, 09 Jan 2010 22:55:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
Greets,
On Sat 09 Jan 2010 11:44, Thien-Thi Nguyen <address@hidden> writes:
> Would there be any interest in adding (ice-9 accumulate) to Guile?
>
> -
> http://www.gnuvola.org/software/guile/doc/Efficient-Accumulation.html
Speaking only for myself, I would be unlikely to use it; but OTOH I am
not against having it.
> I can see several arguments against doing so:
You are not selling your idea very well here. But I'm still OK with it :)
> - The interface is procedural, possibly defeating compiler optimization.
> When i wrote it, it was an exercise for hobbit. The hope was that
> hobbit could eventually learn to optimize usage of (ice-9 accumulate)
> calls to (strength-, complexity-)reduce them to (ice-9 q) calls, where
> other data-oriented optimizations can come into play. Perhaps that
> hope was only a non-compiler-geek dream (sounds nice but unfeasible).
> Perhaps Andy can either revive this hope or kindly kill it off now?
So, here's the deal, as far as I understand inlining... (And your
question is about inlining, afaics, in the sense that the Waddell paper
treats inlining)
(1) Inlining across module boundaries: personally I have no intention of
hacking on this, beyond approaches like define-integrable (see the end
of http://www.scheme.com/tspl3/syntax.html).
The fundamental issue is that our modules are first-class rather than
syntactic. Define-integrable allows you to make a step towards the
syntactic, a very useful step.
(2) Inlining of procedures defined within one file/module: We will
probably do this, probably by treating private bindings from a module as
being letrec-bound within the module.
(3) Inlining of let or letrec-bound procedures: We will do this at some
point, and do it fairly well.
But, in this case, we still wouldn't be able to inline very well,
because it's an side-effecting interface. Once you have side effects, it
gets hard to reason about, especially in the presence of
continuations -- and you usually don't know when a continuation may be
captured.
So this particular construct is unlikely to be inlined nicely. However,
it's useful to you, and might be useful to someone else.
> - There is already something in Guile. [If so, where? Thanks.]
There's lots of stuff in ice-9 that noone knows about, but I don't think
there's something like this. Hopefully we can document more of it using
the new (texinfo reflection) infrastructure.
> Of course, the primary argument *for* adding it would be to make porting
> my stuff to Guile easier. That's a selfish argument, so take it FWIW.
Well, we'd like your energy as well, so selfishness on all sides...
Cheers,
Andy
--
http://wingolog.org/