JuliaRandom / JuliaRandom/RandomExtensions.jl

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

未关闭
#13 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Julia
星标
19
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先使用 Aqua.jl 重现歧义报告,并检查 src/containers.jl 中显示的方法,尤其是第 53 行和第 106 行附近的定义。跟踪它们如何与 pass-through 方法 rand(T::MyAbstractType, v...) 交互;当相关歧义已得到理解,并且项目已确定处理或验证这些歧义的方式时,即可视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
julia
领域
backend-api-design
Issue 类型
缺陷
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。