````
macro need_m()
:(m * 20)
end
function algoX()
m = 10
@need_m
end
algoX()
# 200
````
I think you can create two similar macro to solve your problem.
But i think this is bad practice.
I think you should create some code without a scope, as I know, the macro
can do such thing.
Justas _於 2014年11月17日星期一UTC+8上午4時25分26秒寫道:
>
> Lets say I have this kind of code. How could I access variable M in
> compute() function?
> function algoX(data)
> M,N = size(data)
> param = 20
>
> computeSomething()
> end
>
> export
> function computeSomething()
> a = compute()
> end
>
> function compute()
> # Needs variable M
> M * param
> end
>
> I do not want to nest all functions, because then I wont be able to export
> them for testing. Also I do not want to pass variable M to
> computeSomething() and then pass to compute(). What should I do?
>
>
>