probcomp / gen-quickstart

Gen learning material as Jupyter notebooks
126 stars 50 forks source link

syntax: { } vector syntax is discontinued #94

Open YudiXie opened 1 month ago

YudiXie commented 1 month ago

Hi Gen team,

I am trying to run the tutorial here: https://www.gen.dev/tutorials/intro-to-modeling/tutorial#julia-gen-jupyter In the first tutorial, just by running

my_variable = {:my_variable_address} ~ normal(0, 1)

will generate the following error

syntax: { } vector syntax is discontinued around ...

I am wondering if there is a fix around this, and perhaps I should be using an older julia version? I am using julia 1.10 now.

alex-lew commented 1 month ago

Hi @YudiXie, thanks for trying out Gen!

That syntax is Gen syntax, not general Julia syntax, and can only be used inside of a Gen function:

@gen function my_function()
   my_variable = {:my_variable_address} ~ normal(0, 1)
end

We should perhaps emphasize this more clearly in the tutorial (e.g. by wrapping all such code blocks inside @gen function...end)

Hope that helps!

YudiXie commented 1 month ago

That definitely helps. It is working now. Thank you very much! @alex-lew