nfdi4plants / ARCtrl

Library for management of Annotated Research Contexts (ARCs) using an in-memory representation and runtime-agnostic contract systems.
MIT License
14 stars 8 forks source link

[Feature Request] RO Crate Datamodel - ISA Profile: Add typed getter/setter APIs for known fields #433

Open kMutagene opened 2 months ago

kMutagene commented 2 months ago

Follow-up for #384 as we decided to have more fine-grained PRs/issues on this.

The ISA profile is implemented as classes, but we still need an ergonomic API to work with them programmatically (e.g. to query properties).

As per previous discussion with @HLWeil, here are some necessary implementation details:

kMutagene commented 2 months ago

@HLWeil what about static members that only have one argument?

member this.Foo() = ...
static member foo () =
    fun (a: A) -> a.Foo()

or

member this.Foo() = ...
static member foo (a: A) = a.Foo()

?

HLWeil commented 2 months ago

https://github.com/nfdi4plants/ARCtrl/blob/8b4368aed9a9705a78f95ec752143b1620fb0408/src/Core/Table/ArcTable.fs#L429

Apparently we kept it consistent. Not sure though whether in this case consistency wins over special case usability.

kMutagene commented 2 months ago

So this one it is?

member this.Foo() = ...
static member foo () =
    fun (a: A) -> a.Foo()

I hate it tbh and would rather change the existing API, but i think this is something for the backlog as of #419