-
Notifications
You must be signed in to change notification settings - Fork 150
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
Incorrect element type with .^ after importing Gadfly #78
Comments
Lol. This is a funny one! Assuming Gadfly isn't performing some kind of type piracy, it is possible that my use of Let's check directly with the compiler gods: @vtjnash @JeffBezanson I hope I'm not being rude, but could I ask - should |
No, it may return the wrong answer if you attempt to call it from anywhere inside the generated function generator. |
Thanks for confirming! Can I also confirm that it is OK from the generated function body itself? |
Yes, there are no restrictions on the code of the generated function body. |
Awesome, great! That helps a lot.
(except the comprehensions and closures...) |
Of course. That is not the code for the body, it is the code for another function. |
OK. I think I see how that makes sense. |
EDIT: Sorry got this issue muddled with another :) |
@rdeits could you confirm if this is fixed on master for you, please? |
I'm afraid it's still happening. I've pulled a430568 but I'm getting the same result. |
Ok thanks. I'll keep looking. |
@andyferris looking at your last commit, you changed the wrong functions. It's fine to generate AST that calls As food for thought, you might be able to structure your code such that the types are computed outside of the generator: foo(...) = foo_with_eltype(promote_op(...), ...)
@generate function foo_with_eltype{T}(::Type{T}, args...)
return quote
...
end
end |
Yes... actually the commit amounted to nothing at all but an attempt to be a bit clearer that Now I'm wondering where this is going wrong? |
Ah, ok. Yes that clarification helps, since I misread its intent in passing, going off the original question in this issue. |
I was rather unclear, especially the commit message. Hmm... so I still can reproduce this locally. I get a similar problem with
The closure gets passed to
Here it is apparent the output of @vtjnash should |
OK I've been thinking about this some more. Lately, I do seem to note fishy behaviour in Julia where sometimes inference isn't working very nicely with closures; I think there are some open issues for this. It seems quite possible that the problem here is with |
I wonder if this issue presents anymore? |
I think this was fixed in 0.5.1 |
Let's close this then. I think we've long been aware of the perils of calling generic functions inside the generators and we try not to do it anymore (hopefully we've succeeded!) |
Add type parameter for index style in StructArray
This is a weird one. Here's the typical, correct behavior:
And here's the result after starting a new Julia shell and also importing Gadfly:
Note that the element type has become
Any
.This is in Julia 0.5 with StaticArrays 0.1.0 and Gadfly 0.5.2 I've reproduced it on OSX and Ubuntu 14.04.
Any ideas what would cause this? The issue only shows up with
.^
, not with.*
,.-
, etc.The text was updated successfully, but these errors were encountered: