Skip to content

Type instability when using integers in pattern type that aren't statically known #34

@AntonOresten

Description

@AntonOresten

Non-constant-propagated integers will lead to type instability if used in a pattern.

julia> a = 3;

julia> reduce(sum, x, ((a, :b), ..) --> (:b, ..)); # allowed, but not type stable if `a` is calculated at runtime

julia> reduce(sum, x, ((:a, :b), ..) --> (:b, ..), a=a); # preferred, as the pattern type just has the name

I don't think this would need to happen in a certain macro-based interface (#2 (comment)).

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