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

gensym temporaries clutter the main namespace #19

Open
tshort opened this issue Feb 7, 2013 · 2 comments
Open

gensym temporaries clutter the main namespace #19

tshort opened this issue Feb 7, 2013 · 2 comments

Comments

@tshort
Copy link
Contributor

tshort commented Feb 7, 2013

Here's an example. For @devec_transform (issue #18), I got around that using let, but I'm not sure if that'll work here.

julia> x = rand(5)
5-element Float64 Array:
 0.4517  
 0.61006 
 0.928799
 0.965169
 0.817203

julia> y = rand(5)
5-element Float64 Array:
 0.8758  
 0.598536
 0.653074
 0.730567
 0.824384

julia> @devec z = sqr(x) + y
5-element Float64 Array:
 1.07983 
 0.970709
 1.51574 
 1.66212 
 1.49221 

julia> whos()
##len#63                      Int64
##siz#61                      (Int64,)
##tmp#60                      5-element Float64 Array
##ty#62                       BitsKind
Base                          Module
Core                          Module
DataFrames                    Module
Devectorize                   Module
GZip                          Module
Main                          Module
OptionsMod                    Module
d1                            Dict{String,Any}
df                            DataFrame
n                             Int64
x                             5-element Float64 Array
y                             5-element Float64 Array
z                             5-element Float64 Array
@lindahua
Copy link
Owner

lindahua commented Feb 8, 2013

Thanks for pointing this out -- I will look into this later.

@lindahua
Copy link
Owner

lindahua commented Feb 8, 2013

Simply wrapping everything into a let block does not address this issue. For example,

@devec r = a + b

There is a statement that creates the result r. If this is encapsulated into a let-block, the created variable will not be available in the calling scope.

So I may have to review the code-gen, and try to improve it to reduce the leaking of gensym variables.

At current point, try to encapsulate the use of @devec within functions, which may prevent those variables from leaking into main space.

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