JuliaDynamics / DiscreteEvents.jl

Discrete event generation and simulation in Julia
MIT License
56 stars 10 forks source link

`@wait` macro fails with certain types of conditions #51

Open hdavid16 opened 1 year ago

hdavid16 commented 1 year ago

Need to make this macro more robust.

This fails,

@wait clock !isempty(input)

This is because the function is assumed to be ! and the isempty is not passed to fun internally. Need to recursively build the function to pass to fun inside the macro.

The current workaround is to wrap the function inside another function:

is_not_empty(input) = !isempty(input)
@wait clock is_not_empty(input)
hdavid16 commented 1 year ago

@wait also does not support using an anonymous function for the condition. This is because the expr.head of an anonymous function is :-> instead of :call