Skip to content

Default values that are type stable #32

@juliohm

Description

@juliohm

The following example doesn't work:

immutable Foo{T<:Real}
  a::T = one(T)
end

it says that T is undefined. I can just use the literal 1, but that triggers a conversion behind the scenes, correct?

Also, I'd love to see this functionality as part of the language with additional syntax. Is there an issue tracking this feature request yet?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions