8000 Comparable by edwardpeters · Pull Request #506 · finos/morphir-scala · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Comparable #506

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

Merged
merged 8 commits into from
Jan 10, 2024
Merged

Comparable #506

merged 8 commits into from
Jan 10, 2024

Conversation

edwardpeters
Copy link
Contributor

Implemented Comparable and basics SDK functions that use it

Copy link
linux-foundation-easycla bot commented Jan 8, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.


val nativeCtors: Map[FQName, SDKConstructor] = Map(
FQName.fromString("Morphir.SDK:Maybe:just") -> just,
FQName.fromString("Morphir.SDK:Maybe:nothing") -> nothing,
FQName.fromString("Morphir.SDK:Result:ok") -> ok,
FQName.fromString("Morphir.SDK:Result:err") -> err
FQName.fromString("Morphir.SDK:Result:err") -> err,
FQName.fromString("Morphir.SDK:Basics:GT") -> gt,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI, I added support to be able to put these in the "new" sdk/*SDK.scala definitions, if you prefer to have them there. I think it's straightforward, but happy to walk through if no.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, switched mine over to follow that pattern

@edwardpeters edwardpeters force-pushed the comparable branch 2 times, most recently from 5c704e1 to c0a934c Compare January 9, 2024 00:03
Copy link
Contributor
@justin-corn justin-corn left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for the changes

@justin-corn
Copy link
Contributor

@DamianReeves I'm happy with this, please review when you're able.


case (Concept.Order, RTValue.ConstructorResult(FQString("Morphir.SDK:Basics:gT"), List())) =>
Data.Order(1)
case (Concept.Order, RTValue.ConstructorResult(FQString("Morphir.SDK:Basics:lT"), List())) =>
Copy link
Member

Choose a reason for hiding this comment

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

Why lT and not LT

Data.Order(1)
case (Concept.Order, RTValue.ConstructorResult(FQString("Morphir.SDK:Basics:lT"), List())) =>
Data.Order(-1)
case (Concept.Order, RTValue.ConstructorResult(FQString("Morphir.SDK:Basics:eQ"), List())) =>
Copy link
Member

Choose a reason for hiding this comment

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

Why eQ and not EQ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is using a FQString, which is an extractor intended for easy matching, given that FQName(someString) doesn't work in match statements. FQString uses toString (and then falls back to matching on that string); given that the default is camelCase for the localName, EQ becomes eQ.

Potentially that extractor could be broken up for different formats, but that seemed like a lot of additional complexity for minor gain.

Copy link
Member

Choose a reason for hiding this comment

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

Well that FQString extractor is wrong and not following Morphir name handling conventions. That is going to add un-needed confusion.

Copy link
Member

Choose a reason for hiding this comment

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

I only feel comfortable merging this PR if there is a fast follower to correct FQString. The Morphir naming conventions are unique enough, adding an arbitrary divergence will only complicate things now and in the future.

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 think it's correct when used for functions, but not for constructors/types - looking over use cases, tho, it is mostly (only?) being used for constructors/types. That will only take a moment to change.

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 fixed it, fast enough follow? :)

Copy link
Member
@DamianReeves DamianReeves left a comment

Choose a reason for hiding this comment

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

LGTM

@DamianReeves DamianReeves merged commit f86ddca into finos:main Jan 10, 2024
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.

3 participants
0