NWChemEx / NWChemEx/PluginPlay

PropertyType Traits Class?

Open
#233 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
13
Forks
1
Avg merge
43m
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.
Using auto goes a long ways toward not needing to know the exact types of the inputs/results of a property type. For the times when you do need to know the type it would be nice if there was a traits class.

Describe the solution you'd like
I'd like each PT to have a corresponding traits class from which the user can get the types of the
inputs and results. Ideally this class should be auto-generated. I'm thinking something like:

// FTR the API of AOEnergy is double(const AOSpace&, const ChemicalSystem&)

// Example of getting the traits for the AOEnergy PT
using traits_type = PTTraits<AOEnergy>;

// Typedef of const AOSpace&
using input0_t = typename traits_type::input<0>;

// Typedef of const ChemicalSytem&
using input1_t = typename traits_type::input<1>;

// Typedef of double
using result0_t = typename traits_type::result<0>;

Describe alternatives you've considered
I've taken to manually writing such traits classes in some places, but I think it might be possible to auto generate one. IIRC the way the user specifies the inputs/results causes something like this to be generated under the hood already (that's how we know what types to unwrap/wrap for things like unwrap_inputs) so this issue is really just for exposing that in a user-friendly way.

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 how property types currently record input and result types for operations such as unwrap_inputs. Review the existing property-type definitions and metadata path before deciding how a public PTTraits API could expose those types. Done means users can obtain each input and result type through the proposed traits interface without manually writing traits classes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.