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

badness when VARIABLES is made global const #255

Closed
StefanKarpinski opened this issue Nov 2, 2011 · 4 comments
Closed

badness when VARIABLES is made global const #255

StefanKarpinski opened this issue Nov 2, 2011 · 4 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@StefanKarpinski
Copy link
Sponsor Member

julia> VARIABLES
[]

julia> x = 1
1

julia> VARIABLES
[]

julia> push(VARIABLES, :foo)
[foo]

julia> VARIABLES
[foo]

julia> push(VARIABLES, 1)
no method convert(Type{Symbol},Int64)

julia> VARIABLES
access to undefined reference

julia> length(VARIABLES)
2

I made VARIABLES global and constant in a39ba7b.

@ghost ghost assigned JeffBezanson Nov 2, 2011
StefanKarpinski added a commit that referenced this issue Nov 2, 2011
Two main benefits:
 - type inference can know their types for sure
 - users can't muck with them causing badness

This is some weirdness with VARIABLES (see #255).
@JeffBezanson
Copy link
Sponsor Member

Has nothing to do with const. It's because you made VARIABLES a Symbol array, so pushing an Int64 doesn't work. The problem is then that push grows the array before checking that the assignment will succeed.

@StefanKarpinski
Copy link
Sponsor Member Author

But there's also the issue of :x not showing up in VARIABLES the first time. The latter behavior is broken too though.

@JeffBezanson
Copy link
Sponsor Member

It's because internally i expect VARIABLES to be an Any array, not a Symbol array.

@JeffBezanson
Copy link
Sponsor Member

Fixed in fa87427.

cmcaine pushed a commit to cmcaine/julia that referenced this issue Nov 11, 2022
* CI: Test configlet action

* Update configlet.yml

* Update configlet.yml

* Update .github/workflows/configlet.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants