JuliaData / JuliaData/StructTypes.jl

missing `constructfrom` method for `CustomStruct`?

Open
#69 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
86
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Perhaps I'm misunderstanding the intention of CustomStruct but I believe it is missing a constructfrom method. Even after defining the required methods I get, e.g.

◖◗ ST.constructfrom(Dict{String,Any}, c)
ERROR: MethodError: no method matching constructfrom(::StructTypes.DictType, ::Type{Dict{String, Any}}, ::Type{String}, ::Type{Any}, ::StructTypes.CustomStruct, ::Column{Int64, Count})
Closest candidates are:
  constructfrom(::StructTypes.DictType, ::Type{T}, ::Type{K}, ::Type{V}, ::StructTypes.DictType, ::Any) where {T, K, V} at ~/.julia/packages/StructTypes/Cmlkm/src/StructTypes.jl:961
  constructfrom(::StructTypes.DictType, ::Type{T}, ::Type{K}, ::Type{V}, ::Union{StructTypes.Mutable, StructTypes.Struct}, ::Any) where {T, K, V} at ~/.julia/packages/StructTypes/Cmlkm/src/StructTypes.jl:978
  constructfrom(::StructTypes.DictType, ::Type{T}, ::Type{K}, ::Type{V}, ::S) where {T, K, V, S} at ~/.julia/packages/StructTypes/Cmlkm/src/StructTypes.jl:958
  ...
Stacktrace:
 [1] constructfrom
   @ ~/.julia/packages/StructTypes/Cmlkm/src/StructTypes.jl:958 [inlined]
 [2] constructfrom(#unused#::StructTypes.DictType, #unused#::Type{Dict{String, Any}}, obj::Column{Int64, Count})
   @ StructTypes ~/.julia/packages/StructTypes/Cmlkm/src/StructTypes.jl:955
 [3] constructfrom(#unused#::Type{Dict{String, Any}}, obj::Column{Int64, Count})
   @ StructTypes ~/.julia/packages/StructTypes/Cmlkm/src/StructTypes.jl:905
 [4] top-level scope
   @ REPL[13]:1

I had defined StructTypes.lowertype(::Type{<:Column}) = Dict{String,Any}, so I was expecting this to work.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Julia example using StructTypes.lowertype(::Type{<:Column}) = Dict{String,Any}, then inspect StructTypes.jl around lines 905 and 955-978 alongside the existing constructfrom overloads. Determine how CustomStruct should support this conversion, and verify that constructfrom(Dict{String,Any}, c) works for the reported Column type without the MethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.