Skip to content

ability to mark fields of types as immutable-const #9448

@goretkin

Description

@goretkin

(Julia Version 0.3.4-pre+47)
I should know better than to even be attempting what I was attempting, but perhaps something loud should happen if a user tries to set the .parameters field of a DataType object.

julia> type A{T}
           a::T
       end

julia> A(1)
A{Int64}(1)

julia> A(1.0)
A{Float64}(1.0)

julia> A(1.0f0)
A{Float32}(1.0f0)

julia> A("hello")
A{ASCIIString}("hello")

julia> typeof(A(1)).parameters = (Float64,)
(Float64,)

julia> typeof(A("hello")).parameters = (Int,)
(Int64,)

julia> A(2)
A{Float64}(2) #hm

julia> A("hello")
A{Int64}("hello") #hmm

julia> ans.a
"hello"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions