JuliaMath / JuliaMath/Polynomials.jl

type stability: `(::Polynomial)(::ImmutablePolynomial)` composition yields `ImmutablePolynomial`

Open
#520 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
320
Forks
80
Avg merge
8h 46m
Merged PRs (30d)
3

Description

With v4.0.0:
```julia-repl
julia> using Test, Polynomials

julia> p = ImmutablePolynomial((1,))
ImmutablePolynomial(1)

julia> q = Polynomial([10, 20])
Polynomial(10 + 20*x)

julia> @inferred q(p)
ERROR: return type Polynomials.ImmutableDensePolynomial{Polynomials.StandardBasis, Int64, :x, 1} does not match inferred return type Any
```

It doesn't make sense for this composition to return an `ImmutableDensePolynomial`, because that makes type stability impossible, because the degree of `q` is not available in the type domain.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.