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

The :: val shadows the :: List constructor #189

Open
coreyoconnor opened this issue Sep 25, 2020 · 1 comment
Open

The :: val shadows the :: List constructor #189

coreyoconnor opened this issue Sep 25, 2020 · 1 comment

Comments

@coreyoconnor
Copy link

This :: value: https://github.com/eaplatanios/tensorflow_scala/blob/master/modules/api/src/main/scala/org/platanios/tensorflow/api/package.scala#L80

Will shadow the :: List constructor. The List is a commonly used type from the Scala predef so removing the usability of :: is unexpected.

for example:

import org.platanios.tensorflow.api._
val oh :: no = List(1, 2)

will fail with

cmd0.sc:1: value :: is not a case class, nor does it have an unapply/unapplySeq member
@coreyoconnor
Copy link
Author

Alternatively: Always use +: ( https://www.scala-lang.org/api/current/scala/collection/package$$$plus$colon$.html ) as the pattern matcher. Does not match exactly on the cons case class but, for most uses, has the same effect and is generic across Seq types

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

No branches or pull requests

1 participant