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

Extractor v2 #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Extractor v2 #21

wants to merge 3 commits into from

Conversation

Eagle941
Copy link
Contributor

@Eagle941 Eagle941 commented Mar 3, 2024

Summary

Details

Checklist

  • Code is formatted akin to the other code in the repo.
  • Documentation has been updated if necessary.

@Eagle941 Eagle941 requested a review from a team as a code owner March 3, 2024 23:35
@@ -535,35 +536,35 @@ type Poseidon1 struct {
In frontend.Variable
}

func (g Poseidon1) DefineGadget(api abstractor.API) []frontend.Variable {
func (g Poseidon1) DefineGadget(api frontend.API) interface{} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not frontend.Variable anymore?

Copy link
Contributor Author

@Eagle941 Eagle941 Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we try to describe an interface which can return a single frontend.Variable or n-nested slices of frontend.Variable. interface{} is vanilla for everything. The user needs to know what to expect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, but you can declare the return value as []frontend.Variable for the implementation and it still works with the interface, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e. I understand why API has interface{} but not why the impl has it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because golang is strict and complains does not implement abstractor.GadgetDefinition

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use generics for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants