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

WARNING: both MeasureTheory and TransformVariables export "as"; uses of it in module Main must be qualified #225

Closed
jfb-h opened this issue Aug 20, 2022 · 2 comments

Comments

@jfb-h
Copy link

jfb-h commented Aug 20, 2022

Right now, MeasureTheory and TransformVariables both export as. Is that on purpose or should MeasureTheory extend TransformVariables.as?

@cscherrer
Copy link
Collaborator

It's currently kind of a hack, meant to be temporary.

The as interface is pretty great, and I wanted to be able to extend it easily without type piracy. So MeasureTheory currently has

import TransformVariables
const TV = TransformVariables

as(args...; kwargs...) = TV.as(args...; kwargs...)

I think the current would-be piracy is all for as(::Distribution) methods. Now that we have DistributionMeasures.jl, we could probably get rid of this. But before long, I think we may move away from TransformVariables anyway, for a few reasons:

  1. A value drawn from one measure may sometimes affect the support of another. I don't think TV has a way to address this
  2. TV uses Int type parameters, but I think we'll want to allow for statically-sized arrays, which can be much more efficient
  3. As a personal preference, I'd like transforms to be callable. TV used to have this, but now disallows my_transform(x), instead requiring transform(my_transform, x)

@jfb-h
Copy link
Author

jfb-h commented Aug 21, 2022

I wanted to be able to extend it easily without type piracy

I see, that makes sense. I was trying out MeasureTheory with the LogDensityProblems stack, which was very nice but having to put TV.as everywhere was a bit strange.

Thanks for the heads up!

@jfb-h jfb-h closed this as completed Aug 21, 2022
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

No branches or pull requests

2 participants