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

docs(dafny-java-conversion): JavaDocs for ToNative Blob & Double #252

Merged
merged 18 commits into from
May 15, 2023

Conversation

texastony
Copy link
Contributor

@texastony texastony commented May 8, 2023

Issue #, if available: [Polymorph][Java] Clean up Dafny-Java-Conversion Javadocs

Description of changes:

  • Java Docs for ToNative's Blob & Double methods.

State

  • @robin-aws wants to glance at the methods before I write the rest of the docs.
  • Tony has taken feedback from ^ and applied it, and written all the java docs.
  • @robin-aws may get around to editing the README
  • Anyone can update Smithy-Dafny to use the new package name
    software.amazon.dafny.conversion -> software.amazon.smithy.dafny.conversion
  • Deploy the CFN changes
  • Merge this PR
  • Push to Code Artifact
  • Update Smithy-Dafny's consumers build.gradle.kts
  • Regenerate Smithy-Dafny's consumers Java
    (or sed software.amazon.dafny.conversion -> software.amazon.smithy.dafny.conversion)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@robin-aws robin-aws self-assigned this May 9, 2023
@robin-aws
Copy link
Contributor

Here are my top-level suggestions on this:

  • Rather than using "idiomatic" too much in the documentation, I'd continue focusing on this conversion concept being driven from Smithy concepts. On the one hand you have how a Smithy shape is naturally represented in Java, and on the other you have how Dafny's natural representation is materialized for the Java runtime. So rather than saying "the Dafny-Java type" perhaps we could say "the Dafny runtime type" (where the fact that we're talking about the Java runtime is implicit most of the time).
  • I'd name this library such that it is clearly under the Smithy umbrella, making it even clearly this is a Smithy code generation runtime library, rather than a generic Dafny-Java conversion library (for now). Perhaps software.amazon.smithy.dafny:smithy-dafny-conversion?
  • I'm not going to nitpick about the class and method names, given they are all only intended to be referenced by Smithy-generated code, and I don't think it's worth the trouble to change them.

@texastony texastony marked this pull request as ready for review May 10, 2023 02:41
@texastony texastony requested a review from a team as a code owner May 10, 2023 02:41
Copy link
Contributor

@robin-aws robin-aws left a comment

Choose a reason for hiding this comment

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

Very nice work on the javadoc - I don't expect anyone to reference the methods directly, but you're adding a lot of useful design/implementation detail that future us will thank you for. :)

The nitpicking to the actual docstrings are stronger than the code suggestions I made because I happened to see them - I know the latter are not intended to be in scope for this PR so happy to address those later.

.github/workflows/smithy-dafny-conversion.yml Show resolved Hide resolved
cfn/CA.yaml Show resolved Hide resolved

/**
* @param aString The Java type for a String is {@link String}.
* @return The Dafny Runtime type for a String is A {@link DafnySequence} of {@link Character}s.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd mention "when --unicode-char is false".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not know this.
Can this be a more generic comment?
i.e:

Suggested change
* @return The Dafny Runtime type for a String is A {@link DafnySequence} of {@link Character}s.
* @return The Dafny Runtime type for a String can be a {@link DafnySequence} of {@link Character}s,
* if Dafny is configured to NOT use Unicode characters.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think "IS A" is more accurate, since it will always be a DafnySequence<Character> if --unicode-char is false (and I would avoid "Unicode characters" as that's highly overloaded and misused :) )

FYI we'll probably add more overloads in the future with statements like The Dafny Runtime type for a String is A {@link DafnySequence} of {@link dafny.CodePoint}s if Dafny is configured with --unicode-char set to true

// SET("set", SetShape.class, Category.AGGREGATE),
// TODO: Frankly, we should avoid Dafny Sets since they do not preserve order;
// Smithy 2.0 deprecates Sets for Unique Lists to ensure order is preserved.
// But, we would need to implement our own Dafny Ordered Set...
Copy link
Contributor

Choose a reason for hiding this comment

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

@robin-aws
Copy link
Contributor

Also note I'll cut a separate PR to update the README

@robin-aws robin-aws mentioned this pull request May 15, 2023
@robin-aws
Copy link
Contributor

#255

Copy link
Contributor Author

@texastony texastony left a comment

Choose a reason for hiding this comment

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

Responding to comments.
Will pull down and address outstanding requests.

Copy link
Contributor Author

@texastony texastony left a comment

Choose a reason for hiding this comment

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

Ship it

@robin-aws robin-aws merged commit 66226da into main-1.x May 15, 2023
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