SciML / SciML/ComponentArrays.jl

Constructors should just construct

Open
#82 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
375
Forks
42
Avg merge
7h 25m
Merged PRs (30d)
17

Description

There is too much "non-constructor" work being done by dispatching on constructor methods right now. One big issue with the way it's set up right now is that ComponentArray(x) returns x in cases where x isn't a NamedTuple. This is bad. Constructors should only return their type. All of the recursive handling we're doing in the constructors should be a separate function.

I also have a feeling we could more easily solve some of the indexing constant folding issues if this were simplified.

Contributor guide

Open the contributing guide

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

Start by tracing the ComponentArray(x) constructor and the current dispatch on constructor methods, then inspect how recursive handling and indexing constant folding depend on them. Done means constructors only return their declared type, with recursive handling moved to a separate function and the existing ComponentArray(x) behavior reviewed.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.