Tim Bunce wrote:
> > =item move_to
> >
> > BOOL move_to(void *, PMC);
> >
> > Tells the PMC to move its contents to a block of memory starting at
> > the passed address. Used by the garbage collector to compact memory,
> > this call can return a false value if the move can't be done for some
> > reason. The pointer is guaranteed to point to a chunk of memory at
> > least as large as that returned by the C<real_size> vtable function.
>
> Shouldn't the PMC be the first arg for consistency?
>
I believe the first arg is the result, when this is needed...
> > =item logical_or
> > =item logical_and
> > =item logical_not
>
> Er, why not just use get_bool? The only reason I can think of is to
> support three-value-logic but that would probably be better handled
> via a higher-level overloading kind of mechanism. Either way, clarify.
>
Having logical_* here is an error. This way, perl would have to evaluate
both left and right argument to apply them to this functions, but that would
break short-circuit, where the right hand function is only evaluated if it
should be. This also applies to the ?: operator.
See $f && close $f; now suppose $f is undef, close $f should not be called.
But if this should be passed to a logical_and function, $f and the value
returned by close $f would be evaluated, and then passed to logical_and. So
close $f would be evaluated, what is wrong...
What should be here is bitwise_*, that are different for strings and ints,
for example.
- Branden