Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 13 2018 14:13
    User @SethTisue unbanned @viju0731_twitter
  • Nov 13 2018 14:11
    @SethTisue banned @viju0731_twitter
Ruurtjan
@ruurtjan
Awesome!
Eleanna Skouta
@eleansa
Hello, not sure where to ask but could someone help with pureconfig Java Enum example? I can make my code work with String, but fails when I use Java Enum instead.
Any advice would be appreciated :) thank you
Oron Port
@soronpo
@eleansa please ask at scala/scala channel or melrief/pureconfig
Eleanna Skouta
@eleansa
@soronpo Thank you I asked in melrief/pureconfig but I didn’t have any replies yet
Chris Kipp
@ckipp:matrix.org
[m]
I just came across this on the Scala site https://scalacenter.github.io/platform/
is this still a thing?
Julien Richard-Foy
@julienrf
Hello Chris, no, this project is dormant.
vasim26
@vasim26
I’m a newbie to scala. Using toolBox to convert string to Any, but eval parse works well for string (500 characters ) but doesn't for string that has 500 or more. Not sure what was issue it throws java.lang.StackOverflowError which makes to take sub-set of main string and run individually multiple times.
import scala.tools.reflect.ToolBox

val toolbox = currentMirror.mkToolBox()

input1= """ Validate("x") :: precheck("y") :: Max("z") :: Min("a") :: Check("b") :: Nil"""

val dev1= toolbox.eval(toolbox.parse(input1))
which provides this output for dev1: List(Validate(List(x)), precheck(List(y)), Max(List(z)),Min(List(a)), Check(List(b))) Any help would be greatly appreciated.
Error with strings (>300).
java.lang.StackOverflowError
  at scala.reflect.internal.Importers$StandardImporter.recreateTree(Importers.scala:316)
  at scala.reflect.internal.Importers$StandardImporter.importTree(Importers.scala:415)
Josep Prat
@jlprat
I have a general question, sorry if this is not the right place for it. Is the Scala Center planning on working on support for Scala 3 in Gradle? I would swear I saw a blog post stating something among these lines, but I can't find it back. For reference this is the issue in Gradle, which hasn't seen much action from the Gradle maintainers during the last months (gradle/gradle#16527).
Thanks!
Eric K Richardson
@ekrich
Maybe our community leaders, @tpolecat or @bvenners could look into this when they get a chance. Sometimes it just takes the right folks talking to each other.
Josep Prat
@jlprat
I know Gradle hasn't been the most preferred build tool for Scala, but at least in a major project I collaborate, we are stuck with it. I did some experiments with it, including the right Scala 3 libraries, but the Scala plugin still kind of falls back to Scala 2. I also encountered this work around https://github.com/SimY4/xpath-to-xml/blob/master/xpath-to-xml-scala/build-3.gradle
Guillaume Martres
@smarter
I don't think the scala center has any plan to work on gradle support
but my understanding is that bloop can be used through gradle (https://scalacenter.github.io/bloop/docs/build-tools/gradle) and bloop supports compiling scala 3 projects
Eric K Richardson
@ekrich
Well, maybe Bloop is the best answer rather than direct support for Scala 3.
Josep Prat
@jlprat
I would say it's a good workaround, but many (hybrid Java + Scala) projects might drop Scala support if their build processes need to get more complicated in order to support Scala 3
(not arguing that bloop is a solution, just pointing out that this might not work for some projects)
Tomasz Godzik
@tgodzik
@jlprat I think we should take a look into that anyway, not sur eyet how to push it
Josep Prat
@jlprat
@tgodzik do you have the expertise to provide a PR, even if it's a WIP one, maybe this would make the gradle team turn their attention to it. Also by the looks of the issue, it seems there might be more developers out there that might want to help. I personally do not know much of Gradle, but I could give my best to help out if needed.
Eric K Richardson
@ekrich
@tgodzik If someone on the Gradle side could take it on, I think it would only take a bit of expertise and support from the Scala tools side.
Tomasz Godzik
@tgodzik
not sure how to test it yet
Josep Prat
@jlprat
I see this line was the one causing my "hacked" build.gradle file to still compile with Scala2 compiler: https://github.com/gradle/gradle/compare/master...tgodzik:add-scala3?expand=1#diff-f39ad98e69c11a6beb5b5d19127b60222a442ef36b81debe0f711207f7196926L124
Josep Prat
@jlprat
I'm not sure if this is what you are asking @tgodzik https://github.com/gradle/gradle/blob/master/CONTRIBUTING.md#building-a-distribution-from-source
I'll try to use your patched gradle in a project using gradle and Scala and see it it works
1 reply
Tomasz Godzik
@tgodzik
I think I need to update a couple of things still
Josep Prat
@jlprat
if it's useful, what I'm trying to do is to add Scala3 in Kafka https://github.com/jlprat/kafka/tree/scala3-with-compats -- https://github.com/apache/kafka/pull/11025/files
I was playing with the build.gradle if I could make it use the right compiler, but I was unsuccessful, and I believe it's because of the line I pointed at before
Tomasz Godzik
@tgodzik
I am getting closer, but still having some issues. I will msotly likely take a look next week
3 replies
Josep Prat
@jlprat
No hurries!! Thanks a ton for trying!
Dhanuesh B
@dhanuesh:matrix.org
[m]
Jim Newton
@jimka2001
Hi everyone, can someone help me (rehelp) understand why the following assertion fails. I think I used to understand, but I'm a bit rusty as of late.
val one:Long = 1
assert(classOf[Long].isInstance(one))
Jim Newton
@jimka2001
does the object one get modified/converted to a different type, when passed to a function/method like isInstance ?
Jim Newton
@jimka2001
or is it that not all objects of type Long are instances of class Long and some objects of classLong are not of type Long?
Sébastien Doeraene
@sjrd
classOf[Long] means classOf[scala.Long], which the j.l.Class value for the primitive long. For primitives, isInstance always returns false.
Did you mean classOf[java.lang.Long] instead?
Jim Newton
@jimka2001
ah so Long in one:Long is not the same as Long in classOf[Long]?
Sébastien Doeraene
@sjrd
It is the same. It's scala.Long, the primitive long, in both cases.
Jim Newton
@jimka2001
what do you mean by primitive? do you mean that the number 1 is a primitive, or do you mean that the type long is a primitive?
Sébastien Doeraene
@sjrd
The type long is a JVM primitive.
Jim Newton
@jimka2001
ah ha. and can I know programmatically whether a class (passed as a parameter to my function) is a primitive?
as opposed to a normal class? I see that long has type java.lang.Class
well at least classOf[Long].getClass() returns java.lang.Class
Sébastien Doeraene
@sjrd
classOf[Long].isPrimitive()
Jim Newton
@jimka2001
cool! and once I've determined that a given class is a primitive, how can I know if x is an object of that primitive class, i.e., a function or method similar to isInstance ?
Sébastien Doeraene
@sjrd
You'll have to special-case all 9 primitives and replace them with their equivalent boxed classes. For example classOf[scala.Long] -> classOf[java.lang.Long].
Jim Newton
@jimka2001
@sjrd another thing that is confusing is that 1.getClass() and 1L.getClass() return objects which print as int and long respectively. I don't know the 9 primitives and I don't know the correspondence between them and the scala classes which are compatible with isInstance(). Do I just have to figure this out by trial and error, or is there a resource that I could look at to help me understand?
Sébastien Doeraene
@sjrd
I just realized in what room we are. This is not the right room for technical questions. You should go to scala/scala instead.