Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jul 19 20:37
    @SethTisue banned @tonyobanon
  • Jan 02 23:58
    @SethTisue banned @fakubishes:nerdsin.space
  • Dec 15 2021 05:01
    som-snytt commented #12516
  • Dec 15 2021 04:38
    SethTisue edited #1312
  • Dec 15 2021 04:38
    SethTisue opened #2273
  • Dec 15 2021 04:31
    jackkoenig opened #12516
  • Dec 15 2021 04:29
    SethTisue edited #1312
  • Dec 15 2021 04:28
    SethTisue edited #1312
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    scala-jenkins milestoned #9831
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    SethTisue opened #9831
  • Dec 15 2021 03:35
    som-snytt commented #11339
  • Dec 15 2021 03:27
    som-snytt labeled #12494
  • Dec 15 2021 03:07
    SethTisue edited #1312
  • Dec 15 2021 03:07
    SethTisue edited #1312
  • Dec 15 2021 03:05
    SethTisue edited #1312
  • Dec 15 2021 03:05
    SethTisue edited #1312
  • Dec 15 2021 03:05
    SethTisue edited #1312
  • Dec 15 2021 02:58
    SethTisue edited #1312
Robert D. Blanchet Jr.
@blanchet4forte
Anyone here use reactive mongo? I'm using it with play and play.json and I'm trying to insert a document but its complaining that it can't find the implicit Json Format for the object I'm trying to insert even though its declared in its companion object that is getting imported
Error:(63, 15) No Json serializer as JsObject found for type co.firstfoundry.lagom.scaladsl.api.mongo.OffsetDocument. Try to implement an implicit OWrites or OFormat for this type. .one(offsetDocument)) Error:(63, 15) not enough arguments for method one: (implicit ec: scala.concurrent.ExecutionContext, implicit writer: play.api.libs.json.OWrites[co.firstfoundry.lagom.scaladsl.api.mongo.OffsetDocument])scala.concurrent.Future[reactivemongo.api.commands.WriteResult]. Unspecified value parameter writer. .one(offsetDocument))
Robert D. Blanchet Jr.
@blanchet4forte
figured it out.. my implicit was Format but if I change it to OFormat it finds it.
Ichoran
@Ichoran
@srnb_gitlab - Why do you need to write C++ instead of Rust?
And anyway, Java has mutexes also under ever-so-friendly names like ConcurrentReadWriteLock.
Rob Norris
@tpolecat
Need the equivalent for when there are no threads.
Gavin Bisesi
@Daenyth
TIL json number is a Double and will happily round even integral Long values :trollface:
Naftoli Gugenheim
@nafg
@Daenyth in what context?
Rob Norris
@tpolecat
yes, the 52-bit integers we have all been asking for
Gavin Bisesi
@Daenyth
@nafg in the context of json parsing
Rob Norris
@tpolecat
> 9223372036854775807
9223372036854776000
close enough eh
Gavin Bisesi
@Daenyth
@tpolecat is that the cutoff? Thanks, we want to see how many of our apis ship ids that get broken this way
Rob Norris
@tpolecat
Yeah it's IEEE 754 floating point so you get 52 bits of mantissa and 12 bits of exponent. At least in Javascript. I don't know if JSON itself specifies it.
Martijn Hoekstra
@martijnhoekstra
Json specifies arbitrary precision
Rob Norris
@tpolecat
Ok.
Naftoli Gugenheim
@nafg
@Daenyth parsing it with what?
Gavin Bisesi
@Daenyth
JSON.parse
Martijn Hoekstra
@martijnhoekstra
But stresses that if you want to be interoperable, you probably need to do IEEE or you'll probably have a bad time
Gavin Bisesi
@Daenyth
@tpolecat json doesn't "specify" much
Naftoli Gugenheim
@nafg
@Daenyth in Javascript? Javascript doesn't have Double or Long
Gavin Bisesi
@Daenyth
the json "spec" is that all json numbers are infinite-length perfect precision
@nafg yes, that's why I said number
The context is that I have a jvm backend that has Long values as ids for certain things, and javascript is awful
Martijn Hoekstra
@martijnhoekstra
With an "but if you do that, you're sort of asking for it" disclaimer
Gavin Bisesi
@Daenyth
I wish there was some consensus on a "reasonable json" spec
Naftoli Gugenheim
@nafg
@Daenyth JSON.parse is in javascript, not on the JVM
Gavin Bisesi
@Daenyth
Yes.
I'm aware of that
Naftoli Gugenheim
@nafg
I'm sure you are but there's still a lot that I'm missing
Gavin Bisesi
@Daenyth
JVM backend, js (ts) frontend. JSON between.
An api didn't work right because the frontend was rounding certain identifier values, which were Long on the jvm and serialized as json numbers
that's all there is to it
Naftoli Gugenheim
@nafg
Ah yes, I had that recently
Mainly in a property test using Nyaya
Now I have
  val genJsSafeLong = Gen.chooseLong(-9007199254740991L, 9007199254740991L)
Rob Norris
@tpolecat
We ran into it with timestamps.
GraphQL has real numeric types, which is nice.
Naftoli Gugenheim
@nafg
I mean in my case it's only an issue because Circe for scala.js relies on JSON.parse
IIRC upickle doesn't have that issue
i.e. there's nothing stopping you from parsing JSON in a scala-friendly way in scala.js. It will probably be slower, of course
Oh right -- upickle avoids it by representing Longs as a string
it doesn't use json number for longs
You can customize circe to do that also
Rob Norris
@tpolecat
:musical_note: string, string, string, string, everybody loves string
Naftoli Gugenheim
@nafg
It's better than bytes...
sometimes, anyway
Rob Norris
@tpolecat
could be worse
Naftoli Gugenheim
@nafg
I mean JSON is a string representation
Li Haoyi
@lihaoyi
you can actually tell uPickle to use numbers to represent longs, nowadays we have our own JSON parser written in scala.js that is competitive with JSON.parse