MikeInnes / Lazy.jl

I was gonna maintain this package, but then I got high
Other
470 stars 54 forks source link

`@aside` like Chain.jl #136

Open rben01 opened 1 year ago

rben01 commented 1 year ago

Lazy.jl’s threading macros are nice, but as far as I can tell there is no way to “skip over” a line so that it runs without having its output fed into the next line. Chain.jl has the very handy @aside macro for this purpose. It would be nice if something similar could be added to Lazy.jl. Currently I hack around this with

@as y x begin
    f(y)
    g(y)
    y |> function(z)
        side_effect(z)  # this is where I'd like to use @aside
        return z  # this is just y
    end
    h(y)
end

I'd much prefer just

@as y x begin
    f(y)
    g(y)
    @aside side_effect(y)
    h(y)
end