Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implemented submarine error propagation for
Handle
#619base: main
Are you sure you want to change the base?
Implemented submarine error propagation for
Handle
#619Changes from 11 commits
5ddf622
5d3c47e
4936fef
c62bcdb
bc17ca3
b273d1f
b7861fb
b255b4c
25d703c
4f19410
cb545b9
0b20cfc
74dda73
85e418b
d1167df
a70b9f4
4c26d00
e9c0d37
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is Scala 3, I think with some clever use of
inline
we could make all the allocations / boilerplate disappear from the generated code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried inline in 85e418b.
Combine with moving Inner class out of AdhocSyntaxWired, we completely
remove AdhocSyntaxWired footprint from generated bytecode (user's site)
before:
after:
scala code for both:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another fancy way to do it is using polymorphic function 40a7772:
Generated code is a bit nicer compare to
inline
solution:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! It looks like we are still allocating
InnerWired
, do you think we can make that one go away too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but couldn't find a way.
opaque
doesn't work becauseopaque
doesn't work with context function.I tried with value class by extending
AnyVal
because ofValue classes may not be a member of another class
error.Maybe there is another way? Let me try some more.
btw, which approach do you prefer polymorphic function or inlining?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right, let me investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hit a compiler crash while trying to make
InnerWired
extendsAnyVal
: scala/scala3#22752There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried extension function to replace
InnerWired
like this:but this also failed miserably, because
allow
will eagerly try to consumeHandle[F,E]
, so we can't never reachrescue
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@armanbilge do you have any idea to avoid
InnerWired
, I'm out of idea 😓