Skip to content

Conversation

@pikinier20
Copy link
Contributor

Fixed snippets in "Other new features" section

valentry= (id, Seq(snippetImports, snippet).mkString("\n"))
snippetMap + entry
)
} else snippetMap
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reference documentation of all the changes implemented here? That would make the review easier.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

As for now there's no documentation. I'm gonna add it in this PR

@julienrfjulienrf assigned pikinier20 and unassigned julienrfJul 6, 2021
@bishabosha
Copy link
Member

@pikinier20 just checking if you saw the comments here

@pikinier20pikinier20force-pushed the scaladoc/static-snippets branch from afd0eb7 to e1d3be4CompareJuly 13, 2021 20:29
@dwijnand
Copy link
Member

Looks like this needs a rebase now, btw.

@pikinier20
Copy link
ContributorAuthor

I've created a PR to docs.scala-lang with documentation of snippet compiler

#2146

@pikinier20pikinier20force-pushed the scaladoc/static-snippets branch from abaef17 to 05fd457CompareJuly 30, 2021 15:14
@pikinier20
Copy link
ContributorAuthor

This PR has been split into two. This PR should be merged after: #13217

@pikinier20pikinier20force-pushed the scaladoc/static-snippets branch from 05fd457 to 1669943CompareAugust 3, 2021 08:54
Copy link
Contributor

@julienrfjulienrf left a comment

Choose a reason for hiding this comment

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

Overall, this looks good but the up to date content of the documentation is now hosted on the scala/docs.scala-lang repository.
If we want to leverage the snippet compiler, we need to also set up a process to publish the processed files to the docs.scala-lang repo.

```scala
//{
importlanguage.experimental.fewerBraces
deftimes(i: Int)(fn: =>Unit) = (0 to i).foreach(x => fn)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we show both the import and the def, in the snippet, instead of putting them to the snippet context?

// File EncryptedWriter.scala
packagep
traitEncrypter[T]:
defencrypt(t: T):T=???
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def encrypt(t: T): T = ???
def encrypt(t: T): T

field points to an initialized object may not later point to an
object under initialization. As an example, the following code will be rejected:

```scala
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add sc-fail then?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Apparently, this code breaks only at runtime.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this expected? cc @liufengyun

extension [T](xs: Vec[T])
@targetName("append")
def++=[T] (ys: Vec[T]):Vec[T] =...
def++= (ys: Vec[T]):Vec[T] =???
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

```scala
deff[X, Y](x: X)(usingtt: TypeTest[X, Y]):Option[Y] = x match
//{
importscala.reflect.TypeTest
Copy link
Contributor

Choose a reason for hiding this comment

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

What about showing the import?

@pikinier20pikinier20force-pushed the scaladoc/static-snippets branch from 1669943 to aa46475CompareAugust 4, 2021 08:44
@pikinier20
Copy link
ContributorAuthor

I close this PR because the documentation is migrated to docs.scala-lang and these changes don't make sense without using snippet compiler

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@pikinier20@bishabosha@dwijnand@julienrf