On Thu, Jun 5, 2008 at 5:03 PM, David MacIver <
david.maciver@...> wrote:
On Thu, Jun 5, 2008 at 10:53 PM, Nils Kilden-Pedersen <
nilskp@...> wrote:
> On Thu, Jun 5, 2008 at 4:17 PM, David MacIver <
david.maciver@...>
> wrote:
>>
>> It will. instanceof is pretty quick these days.
>
> Everything is relative. I work with code where we sometimes do microsecond
> optimizations.
The way to get microsecond optimisations out of anything like this is
"don't use the language feature. Roll your own evaluation strategy
that will be better suited to your needs". If you arrange it right an
instanceof check is about two instructions. That's pretty quick by any
metric which involves writing for the JVM. :-)
> Why exactly would it be needed?
Because you need to distinguish between the case where you have a
value and the case where you have a thunk waiting to be a value...
A boolean or int won't solve that?