Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use M as variable name #331

Open
marius311 opened this issue May 5, 2022 · 4 comments · May be fixed by #340
Open

Can't use M as variable name #331

marius311 opened this issue May 5, 2022 · 4 comments · May be fixed by #340
Assignees

Comments

@marius311
Copy link

Random thing I unearthed w/ Soss v0.20.9 and GeneralizedGenerated v0.3.3, not sure if it belongs here or there but I only know how to trigger it from here:

model = @model () begin
    M ~ Normal()
end
rand(model) # invalid let syntax
@cscherrer
Copy link
Owner

Sorry for the delay on this. I've just released a new version that works with the latest MeasureTheory, so I think we can address this in a minor release.

The problem comes from this:

@gg function _rand(M::Type{<:TypeLevel}, _m::Model, _args)
    body = type2model(_m) |> sourceRand() |> loadvals(_args, NamedTuple())
    @under_global from_type(_unwrap_type(M)) @q let M
        $body
    end
end

@thautwarm I don't understand what this let M without a binding is doing. I think it would be ok to change all M references to _M, but even better would be to gensym the name. Do you see a way for that to work? Or if not we can just use _M or some more complicated version.

@thautwarm
Copy link
Collaborator

thautwarm commented May 25, 2022

I just played with Soss and this example, it seems that JuliaVariables.jl gets broken in 1.7
Will investigate this tonight.

@thautwarm
Copy link
Collaborator

Hope I can give some results tomorrow.
Debugging GG functions is hard, and I should make it support viewing the generated code with InteractiveUtils.less.

@cscherrer
Copy link
Owner

Sounds good. Thanks for digging into this!

@cscherrer cscherrer linked a pull request Jun 7, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants