Skip to content

NL#155

Open
som-snytt wants to merge 1 commit into
scalapuzzlers:masterfrom
som-snytt:puzzle/enter
Open

NL#155
som-snytt wants to merge 1 commit into
scalapuzzlers:masterfrom
som-snytt:puzzle/enter

Conversation

@som-snytt

Copy link
Copy Markdown
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

demobox commented Sep 10, 2019

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
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

demobox commented Jan 17, 2020

Copy link
Copy Markdown
Collaborator

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

som-snytt commented Jan 17, 2020

Copy link
Copy Markdown
Contributor Author

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