Skip to content

Conversation

@som-snytt
Copy link
Contributor

Someone said, "I was surprised this isn't on scalapuzzlers.com."

Which should go on the next version of the t-shirt.

I numbered it 26 because sadly, now that scalaz is not in the community build, it will probably never get a puzzler. But on the upside, that is a feature.

I was surprised to find recent commit activity! All that dust must make you sneeze.

@demobox
Copy link
Collaborator

demobox commented Sep 10, 2019

Is there some way this can be done in the REPL (e.g. using :paste -raw), or does it require scalac?

I ask since, in general, the "rule" for puzzlers has been that they are a self-contained piece of code you can run in the REPL.

@som-snytt
Copy link
Contributor Author

Rules are made to be broken.

Also, it's a chance to branch out into scala script runner puzzlers.

@som-snytt
Copy link
Contributor Author

Hey, that's not bad. The text is muddied with alternatives, and in fact it looks better straight in REPL as suggested:

scala> :pa
// Entering paste mode (ctrl-D to finish)

class C
/* This is a long
 * commentary.

 */
{
  println("""This is a long
commentary.

""")
}

// Exiting paste mode, now interpreting.

This is a long
commentary.


defined class C

scala> new C
res5: C = C@1fc4483f

This behavior is known but not widely complained about because no one writes comments.

@demobox
Copy link
Collaborator

demobox commented Jan 17, 2020

This behavior is known but not widely complained about because no one writes comments.

Deprecation candidate? ;-)

As regards the example, is the paste mode version in line with what we'd expect from the original example? The way I was reading the puzzler, that was the version that didn't compile?

@som-snytt
Copy link
Contributor Author

som-snytt commented Jan 17, 2020

It's the same as

class C ; println("text")

and you see output right away.

I wonder if "Newline Cinema" is still in business? It would make a good title.

Also, same behavior in doti! The next edition of the book can have one of those star-shaped stickers: "Certified for Scala 3!"

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