Why Val{...}?

Why is Val{..} needed? Shouldn’t constant propagation make Val obsolete (https://github.com/JuliaLang/julia/pull/24362)?

Val forces specialization which can sometimes be desired.

1 Like

Val also predates that kind of contant propagation.

Sure, my point was just that even now, there are reasons why it is still useful.

1 Like

Is there an example, where constant propagation is not enough?

You might not only want to specialize on constants.

2 Likes