On Mon, May 30, 2016 at 2:25 PM, Ford Ox <[email protected]> wrote:
> Yeah I have read it. Multiple times, since I forget things and I still don't
> remember all the things.
>
> So basically the difference is that bitwise operators are functions. That
> means its arguments get evaluated before they are passed in. That also
> means, that if that function would be inlined, && would be same as &
> because:
>
> &(x::Bool, y::Bool) = box(Bool,and_int(unbox(Bool,x),unbox(Bool,y)))
> I dont really understand that function, since I dont know what box, unbox
> is, but I guess it is something like
> &(x::Bool, y::Bool) = x && y
> so if & would be inlined before x, y are evaluated, than && and & would have
> identical meaning ( for booleans ), right?
>
> Something like
> function x()
>     println("x")
>     true
> end
> function y()
>     println("y")
>     false
> end
> @generated_inline and_gen(x::Bool, y::Bool)

FWIW, I think the inline metadata needs to be attached to the return
value, not the function. It doesn't matter for what you want to do
though.

>     return :(x && y)
> end
>
> and_gen(y(), x())

Reply via email to