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

Update extractor-objects.md #3133

Closed
wants to merge 1 commit into from
Closed

Conversation

ErikPohl444
Copy link
Contributor

The customerid match case does not run in Scastie for Scala 3 without curly braces.

I've added them here.

Is this a problem with Scastie's Scala 3? If so, you can reject the PR and fix Scastie.

Is this a fix for the tutorial code for Scala 3? If so, please accept this PR.

The customerid match case does not run in Scastie for Scala 3 without curly braces.

I've added them here.

Is this a problem with Scastie's Scala 3? If so, you can reject the PR and fix Scastie.

Is this a fix for the tutorial code for Scala 3?  If so, please accept this PR.
@Philippus
Copy link
Member

Philippus commented Dec 13, 2024

I think this might be a bug? It works if I wrap it in something, like in a def:

(...) 
def matcher() =
  customer1ID match
    case CustomerID(name) => println(name) // prints Sukyoung
    case _ => println("Could not extract a CustomerID")
matcher()

@ErikPohl444
Copy link
Contributor Author

Do you think it is a bug in the documentation [my PR] or in Scastie?

The matcher() def works for me, as well as curly braces.

If it is a Scastie bug, then I request someone closer to Scastie's to enter an issue for it relating to this.
If it is something which would benefit from a change in the tour, please let me know if you'd rather curly braces or a def statement.

Right now, the tour does not work in Scastie.

At the very least, I could submit a disclaimer in the tour for the code not working in Scastie for Scala 3.

Let me know your preference!

@Philippus
Copy link
Member

I think it might be a case of scalacenter/scastie#929.

@ErikPohl444
Copy link
Contributor Author

Good catch. I know as a newbie I spent a while on stack overflow trying to find out the proper syntax for this code to work in Scala 3, and finally just using curly braces. It is a Scastie issue, and Scastie is recommended for people using the tour.

How about I remove the curly braces from my pull request in the Scala 3 code blocks I've committed changes for, and I add a disclaimer that -- for people following along in Scastie -- they'll need to use the Scala 2 code block.

Does that sound fair to you? That way the Scala 3 code block will maintain its no-braces status, and people like me wandering through the tour with Scastie will not wonder why the code doesn't work for us.

@adpi2
Copy link
Member

adpi2 commented Dec 16, 2024

Thanks @ErikPohl444 for reporting this issue and proposing a mitigation plan.

Does that sound fair to you? That way the Scala 3 code block will maintain its no-braces status, and people like me wandering through the tour with Scastie will not wonder why the code doesn't work for us.

This is appears to be an important bug in Scastie, and we should prioritize addressing it. Let's see if we manage to fix it before adding any disclaimer.

@ErikPohl444
Copy link
Contributor Author

Addressing the root cause is ideal. Thanks!

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