On Saturday, 21 September 2013 at 10:53:17 UTC, Peter Alexander
wrote:
On Saturday, 21 September 2013 at 10:29:35 UTC, Dicebot wrote:
Lot of code bloat comes from stuff which is unnecessary in the
big picture but compiler has to means to decide it during
compilation. There is no real reason why
`[1, 2, 3].map!(a => a*2)().reduce!((a, b) => a + b)(0)`
can't be reduce to single loop and inlined, leaving no traces
of actual std.algorithm usage.
There's no theoretical reason, but plenty of practical reasons.
bearophile linked to a talk by Chandler Carruth that explains
the difficulties encountered by inlining optimisers.
I wasn't referring to actual inlining but to "remove all unused
that is left after inlining". You point is solid, of course,
there is nothing trivial about robust inline optimizations - but
is possible within existing language design.