JuliaRandom / JuliaRandom/RandomExtensions.jl

A lot of ambiguities due to too general `rand`signatures

Offen
#13 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
19
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

We are still using this quite heavily in Oscar land, but after playing around with https://github.com/JuliaTesting/Aqua.jl (which helps detecting method ambiguities), I noticed that RandomExtensions.jl leads to a lot of method ambiguities. For example, the methods
```
rand(X, ::Type{Tuple}, n::Integer)
@ RandomExtensions ~/.julia/packages/RandomExtensions/qAD6J/src/containers.jl:53
rand(X, t::Type{<:Array}, dims::Integer...)
@ RandomExtensions ~/.julia/packages/RandomExtensions/qAD6J/src/containers.jl:106
```
will make the pass-through methods
```
rand(T::MyAbstractType, v...) = rand(GLOBAL_RNG, T, v...)
```
ambiguous for certain input types (note that I cannot pin down the type of `v` directly, since `T` is abstract and there are many possible combinations).

They are usually fine in practice, but it just looks bad. There are so many, that ignoring them might hide real ambiguities.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.