These are chat archives for typelevel/scala

30th
Apr 2017
Oron Port
@soronpo
Apr 30 2017 06:20
@mandubian With BigInt comes BigResponsibility
Alexander Konovalov
@alexknvl
Apr 30 2017 06:24
But it's the same Big O.
Paolo G. Giarrusso
@Blaisorblade
Apr 30 2017 09:18
beyond the jokes, O(1) is just for BigInts representing Int
Edmund Noble
@edmundnoble
Apr 30 2017 17:01
Oh who cares about big O. Everyone who cares about big O can use finger trees all over their program ;)
Paul Phillips
@paulp
Apr 30 2017 18:41
@soronpo there's "literally" no way to get a byte or short constant value to be inlined by the compiler, because the only mechanism scala offers is to declare it final with no type ascription, but with no type ascription it will be inferred to be an Int.
But constant inlining or the lack thereof can have heroic/catastrophic implications for performance.
Shane Delmore
@ShaneDelmore
Apr 30 2017 18:51
Also, last I remember the final with no type ascription hint interfered with incremental compilation.
Paul Phillips
@paulp
Apr 30 2017 18:53
@ShaneDelmore presumably you're referring to the fact that constant inlining isn't reflected in the AST, so the incremental compiler can't deduce the dependencies.
But that is more of a consequence of the AST not representing reality, not a knock on final without type ascription per se.
Which is not to say that it's desirable - it's not, as documented at https://issues.scala-lang.org/browse/SI-7542
Shane Delmore
@ShaneDelmore
Apr 30 2017 18:59
Nice that link will be helpful next time I hear "I made it final with no type ascription to make it auto-inlined and faster".
Paul Phillips
@paulp
Apr 30 2017 19:01
Why does cats use the type Option[Comparison] when Comparison is in cats? You could make that much nicer to use with a PartialComparison superclass to Comparison, and an Incomparable which extends PartialComparison but not Comparison.
You wouldn't need this:
  // Used for fromDouble
  private val SomeGt = Some(Comparison.GreaterThan)
  private val SomeEq = Some(Comparison.EqualTo)
  private val SomeLt = Some(Comparison.LessThan)
There would be half the boxing and half the unwrapping.
The structure of the Comparison hierarchy would then mirror the structure of the Order hierarchy (Order extends PartialOrder).
I guess I'll redirect all that to the cats room since I can't keep track of where I am.
som-snytt
@som-snytt
Apr 30 2017 20:16
I always assumed Dr Odersky was the Big O.