That's pretty difficult as my goal is to use embedded Julia as the templating language. Similar to Ruby's ERB, ex: http://www.stuartellis.eu/articles/erb/
So say in the template I have something like <% if foo == "bar" %> Bar <% else %> Baz <% end %> The idea is to use Julia itself to parse the code block and Julia will raise an error is foo is not defined. So I can't really look it up. I can either do <% if _[:foo] == "bar" %> or <% if _(:foo) == "bar" %> but it's not that nice. sâmbătă, 13 august 2016, 13:24:18 UTC+2, Yichao Yu a scris: > > > > On Sat, Aug 13, 2016 at 7:13 PM, Adrian Salceanu <adrian....@gmail.com > <javascript:>> wrote: > >> Thanks >> >> It's for a templating engine. The user creates the document (a string) >> which contains interpolated variables placeholders and markup. When the >> template is rendered, the placeholders must be replaced with the >> corresponding values from the dict. >> >> The lines in the template are eval-ed and so Julia will look for the >> variables in the scope. So the vars should be already defined. >> > > You should explicitly look up those variables in the dict instead. > > >> >> Yes, ultimately I can force the user to use a dict (or rather a function >> for a bit of semantic sugar) - which is preferable from a performance >> perspective, but less pretty end error prone from the user perspective. > > >