Combining abstract types and parametric types?
まだ誰も着手していません。
評価
調査の方向性
まず、issue に記載されている既存の StructTypes.StructType、subtypekey、subtypes のエントリポイントを確認し、提案されている parametrickey API と比較します。抽象サブタイプとの相互作用を含め、型パラメーターの値をどのように表現し、再構築すべきかを判断します。動作と API が実装およびそのテストを導けるだけ明確に仕様化されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Let's say I have a type hierarchy like this:
abstract type Parent end
mutable struct Child1 <: Parent
type # Set to 'child1'
end
mutable struct Child2{N<:Integer} <: Parent
type # Set to 'child2'
i::N
end
StructTypes.StructType(::Type{Parent}) = StructTypes.AbstractType()
StructTypes.StructType(::Type{Child1}) = StructTypes.Mutable()
StructTypes.StructType(::Type{<:Child2}) = StructTypes.Mutable()
StructTypes.subtypekey(::Type{Parent}) = :type
StructTypes.subtypes(::Type{Parent}) = (child1=Child1, child2=Child2)
Currently, afaik, there is no mechanism for StructTypes to serialize/deserialize the value of N, like how it can write the type key for each child.
Current workarounds I can think of:
- Pick a unique
typename for each concrete version ofChild2{N}you expect to be possible:(child1=Child1, child2U8=Child2{UInt8}, child2I32=Child2{Int32}, ...) - Use
UnorderedStructorOrderedStructinstead ofMutable, and let the type parameter be inferred by the constructor.
Would it be feasible to support deserializing type parameters in the same way as the type itself? For example:
struct Child2{N<:Integer} <: Parent
type # Set to 'child2'
int_type::Type # Set to string(N)
i::N
end
StructTypes.parametrickey(::Type{<:Child2}, ::Val{1}) = :int_type
- 主要言語
- Julia
- スター
- 86
- フォーク
- 21
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaData/StructTypes.jl のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaData/StructTypes.jl#104 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
JuliaData/StructTypes.jl#102 · コメント 1 件 ·
-
Register v1.11.0?オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
JuliaData/StructTypes.jl#98 · コメント 2 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
JuliaData/StructTypes.jl#96 · コメント 1 件 ·
-
`StructTypes.x` is not defined対応中かも @sunoru が 1125 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
JuliaData/StructTypes.jl#92 · コメント 3 件 ·
JuliaData/StructTypes.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
CliMA/ClimaAtmos.jl#4891 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
tagbot-manual
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
tshort/StaticCompiler.jl#191 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
SciML/SciMLSensitivity.jl#1703 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
JuliaGPU/GPUCompiler.jl#1008 ·
メンテナーはふだん 1 日以内に返信
-
`biggs6` disagrees with CUTEst and is unbounded below対応中かも @timholy が 1 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100