Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kMutagene opened this issue Sep 5, 2024 · 3 comments · Fixed by #436
Assignees
Labels
Status: Needs Triage This item is up for investigation.

Comments

@kMutagene
Copy link
Member

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:

  • all functionality should be implemented as both instance methods and static methods on the class
  • all methods should use tupled named arguments
  • static methods should return a function that calls the instance method of the input.
  • Example:
    type A(...) =
        ...
        member this.Foo(arg1, arg2) = ...
        static member foo (arg1, arg2) =
            fun (a: A) -> a.Foo(arg1, arg2)
@github-actions github-actions bot added the Status: Needs Triage This item is up for investigation. label Sep 5, 2024
@kMutagene
Copy link
Member Author

@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
Copy link
Member

HLWeil commented Sep 6, 2024

static member getOutputColumn () =

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

@kMutagene kMutagene self-assigned this Sep 6, 2024
@kMutagene kMutagene removed the Status: Needs Triage This item is up for investigation. label Sep 6, 2024
@kMutagene
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage This item is up for investigation.
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

2 participants