On Wednesday, 4 July 2012 at 08:31:05 UTC, Jonathan M Davis wrote:
But if the default is that there is no consumeFront, then it'll
only be there when the programmer determines that they need it
and defines it. So, the default is safe, but the option of
efficiency is there if the programmer codes for it.
OK, you sold it to me :) If some developer decides to use
consumeFront for efficiency reasons, it should not be a problem
to statically check hasConsume. What I was trying to avoid was
code bloat at clients, assuming that they used consumeFront to
have less code (one call instead of two). That would be a very
different use case, and currently proposed design doesn't fit
that use case. But it is really minor comparing to potential risk.