On Tuesday, August 18, 2015 at 2:11:40 PM UTC+2, Yichao Yu wrote: > > On Tue, Aug 18, 2015 at 6:49 AM, Sisyphuss <zhengw...@gmail.com > <javascript:>> wrote: > > I'm reading the documentation Metaprogramming chapter. > > To me, the `$` operator is different from the one in the string > > interpolation. > > In the string, `$` is a runtime interpolation. > > In the expression, `$` is a compile-time interpolation. > > No. Both of them happens at whenever the expression is evaluated. It > happens for `@eval` at "compile time" because that's when the macro > expansion happens. > > for i in 1:3 println("$(rand())") end It prints different values each iteration, so it's run-time interpolation.
> > > > In one example provided, `ex = :(a in $:((1,2,3)) )`, > > I find that it's equal to `ex = :(a in (1,2,3) )`. > > So I do not see the intention of `$`. > > The examples are meant to show you the basic rules not necessarily the > best/only way to do it. > Really don't see the rules from these examples. > > > > > In the next example, there is `:a + :b` in the expression, > > but the sum of `Symbols` is not defined. Is it wrong? > > It just construct an expression and to show you that the result is > quoted symbol rather than the symbol themselves. >