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

FR: preserve argument names using Candid named argument types. #4344

Open
crusso opened this issue Jan 2, 2024 · 0 comments
Open

FR: preserve argument names using Candid named argument types. #4344

crusso opened this issue Jan 2, 2024 · 0 comments

Comments

@crusso
Copy link
Contributor

crusso commented Jan 2, 2024

@letmejustputthishere suggests:

for a method like this

  public query func greet(name : Text) : async Text {
    return "Hello, " # name # "!";
  };

why doesn’t the generated did contain the names for the arguments?
e.g.

service : {
  greet: (name: text) -> (text) query;
}

instead of

service : {
  greet: (text) -> (text) query;
}

https://dfinity.slack.com/archives/CPVUFG8UV/p1704194551430229

Claudio Russo
I expect it's because the Candid is generated from the internal type representation, not the syntactic types, and those names have been removed. (edited)
Moritz Fuller
could we change this? imo it would be really helpful to have those annotations in the interface
Claudio Russo
I don't think it's trivial to change, but would it not be better to just use a record if you want to name the arguments?
Moritz Fuller
i suggested that as well, but i see no reason why this information should be lost when going from motoko to candid :thinking_face:
Claudio Russo
Since it's not pertinent to subtyping, we would need to both maintain yet ignore it everywhere. It might be doable though, just awkward to flow through without disturbing things.

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

No branches or pull requests

1 participant