Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 23 06:34
    @sjrd banned @Rebeka58_gitlab
  • Jun 08 2020 20:43
    @sjrd banned @sw7240614
  • Sep 29 2019 08:35
    @sjrd banned @8bitpitRBX_twitter
  • May 23 2019 13:44
    @sjrd banned @BIGCRYPTO001_gitlab
  • May 01 2019 14:31
    @sjrd banned @Certificates1_gitlab
  • Apr 22 2019 15:31
    @sjrd banned @lerbatax
  • Jan 31 2019 23:04
    sjrd commented #3555
  • Jan 31 2019 22:56
    sjrd review_requested #3555
  • Jan 31 2019 22:56
    sjrd opened #3555
  • Jan 31 2019 21:06

    sjrd on 0.6.x

    Remove dead code: specific coll… Adapt the signature of `js.Arra… Merge pull request #3554 from s… (compare)

  • Jan 31 2019 21:06
    sjrd closed #3554
  • Jan 31 2019 20:54
    erikvanoosten commented #2665
  • Jan 31 2019 16:33
    sjrd commented #3538
  • Jan 31 2019 15:54

    sjrd on master

    Fix analyzer cycle detection to… Add toString methods to analyze… Do not provide linked ClassInfo… and 1 more (compare)

  • Jan 31 2019 15:54
    sjrd closed #3552
  • Jan 31 2019 15:54

    sjrd on master

    Remove Logger.success It is un… Make level helpers final Clean-up ScalaConsoleLogger cod… and 1 more (compare)

  • Jan 31 2019 15:54
    sjrd closed #3553
  • Jan 31 2019 15:33
    sjrd commented #2665
  • Jan 31 2019 15:30
    erikvanoosten commented #2665
  • Jan 31 2019 10:41
    sjrd review_requested #3554
Jeff Lewis
@lewisjkl
Thanks for the info and the g8! I used snowpack on my last front end and it was pretty awesome. Definitely a rougher road to travel since there are less resources when something goes wrong. Cool stuff though and excited for Snowpack 3
Jack Koenig
@jackkoenig
Can Scalac or the Scala 3 compiler themselves be compiled with ScalaJS?
I'm imagining something like ScalaFiddle that runs completely in your browser
Sébastien Doeraene
@sjrd
No, they can't. They rely too much on JVM-only stuff like synchronous file access and Java libraries.
Michael Pilquist
@mpilquist

I'm running in to some issues when upgrading FS2 to sjs 1.4.0. Some are self inflicted due to use of .isInstanceOf[Int], which I've fixed. However now I'm seeing runtime exceptions like this:

Exception: scala.scalajs.js.JavaScriptException: TypeError: dest.u.set is not a function

Looking in the compiled js, I see:

$ac_I.prototype.copyTo = (function(srcPos, dest, destPos, length) {
  $arraycopyCheckBounds(this.u.length, srcPos, dest.u.length, destPos, length);
  dest.u.set(this.u.subarray(srcPos, ((srcPos + length) | 0)), destPos)
});
Sébastien Doeraene
@sjrd
Hum, you may be running into a bug in the new Array encoding.
That method you see is used for System.arraycopy calls. It seems dest might not be an Array value.
It could be our fault, but it could also be on your side if you call System.arraycopy with a 3rd parameter than is not an Array value.
Michael Pilquist
@mpilquist
thanks, I definitely have some System.arraycopy calls, I'll poke around there
stuff like:
def copyToArray[O2 >: O](xs: Array[O2], start: Int): Unit =
      if (xs.isInstanceOf[Array[AnyRef]])
        System.arraycopy(values, offset, xs, start, length)
      else {
        values.iterator.slice(offset, offset + length).copyToArray(xs, start)
        ()
      }
repeat for each primitive type -- guessing one of those isInstanceOf calls changed behavior
Sébastien Doeraene
@sjrd
They shouldn't have. If they have, that's a bug on our side.
aappddeevv
@aappddeevv
I put together a scala.js, react lazy loading, dynamic modules example. Let me know if it does not work for you: https://github.com/aappddeevv/scalajs-dynamic-modules
Sébastien Doeraene
@sjrd
Oh cool :)
aappddeevv
@aappddeevv
It worked the first time, which is always wonderful.
Sébastien Doeraene
@sjrd
@mpilquist If you manage to minimize the bug or even just give a reproduction, I'd be happy to see a bug report :)
Michael Pilquist
@mpilquist
yep, will do -- i confirmed that commenting out all the arraycopy calls in fs2.Chunk fixes, will narrow it down more and update you one way or another
Sébastien Doeraene
@sjrd
Thanks!
Michael Pilquist
@mpilquist

Alright, I narrowed it down to this, which "worked" on 1.3.1 and throws on 1.4.0:

    val src: Array[Int] = new Array[Int](10)
    val dest: Array[AnyRef] = new Array[AnyRef](10)
    System.arraycopy(src, 0, dest, 0, 10)

Seems fair to me as this throws ArrayStoreException on the jvm

Sébastien Doeraene
@sjrd
Ah! That makes sense, indeed. In that case I'm afraid it's a bug in your code indeed, since it doesn't work on the JVM.
It worked by chance before.
Michael Pilquist
@mpilquist
yep
aappddeevv
@aappddeevv
I need to pass an async iterator to a js API. Has anyone found any patterns in scala.js that can help interface to this type of requirement? I need this server-side/node.js so I'm wondering if a package like https://github.com/achingbrain/it could help with interfacing to scala.js.
Iurii Malchenko
@yurique
does anyone know if it possible to enable a plugin only for .js project when using crossProject(…).crossType(Pure)? (for the ScalaJSJUnitPlugin)
Sébastien Doeraene
@sjrd
.jsConfigure(_.enablePlugins(...))
Iurii Malchenko
@yurique
Thank you! (how did I miss that?.. 🤔)
Eric K Richardson
@ekrich
Is there a parallel one for Scala Native? I couldn't find one.
Sébastien Doeraene
@sjrd
There should be .nativeConfigure
Eric K Richardson
@ekrich
If it is there, it doesn't seem visible.
If it's in a Build.scala, it might need an explicit import of the autoImport._ members.
Victor Hiairrassary
@vhiairrassary

Hi there :wave: I have a couple of open pull requests for different repositories around Scala.js. Ideally, I would love to get feedbacks & be able to participate in the community. (feel free to discard this comment if it is not in the correct conversation)
scalajs-bundler:

Anyway, thank you to all the people involved in this project and for the time spent!

1 reply
Sébastien Doeraene
@sjrd
Hi @vhiairrassary. Sorry we haven't been responsive so far. I don't put my head into scalajs-bundler or scalajs-dom very often. I'll try to allocate time this week to look at those.
1 reply
Eric K Richardson
@ekrich
@sjrd I was using build.sbt and it is there and works - for some reason Metals does not find it. With the 1.0.0 plugin, everything is like magic - so used to imports, enables, etc.
Andreane Schultz
@Andreane56_gitlab
Thanks yo for posting that it could be just the in thing to give inspiration to someone who need it! Keep up the great work. https://www.myaarpmedicare.review/
Dave Smith
@davesmith00000
Hi @sjrd - I was wondering if I could ask your opinion: I'm going to pass a potentially large nested case class structure (also contains ADTs but could possibly be factored out if that helps) to a Web Worker. What do you think is the most efficient/performant way to convert the structure to JS objects and back? (worker interface takes js.Any I believe)
I'm currently hand rolling it all using js.Dynamic.literal() to produce a crude codec, which is boring but ok, but I'm wondering about the allocate costs of such a thing (?) and thought I'd see if there was a simpler/better solution? I would be doing this 60 times per second...
Sébastien Doeraene
@sjrd
I don't really have a good suggestion. It's either literal()s, or serializing a to an ArrayBuffer. An ArrayBuffer would probably be quicker to allocate, but you have to pay the price of serialization and deserialization. Only measuring can decide which is truly better.
Anton Sviridov
@keynmol

we don't use web workers, but for lots of small objects we do use literals, but our data structures are small and not recursive, so hand cranking those codecs is simple.

In a different usecase with a huge recursive case class I'm using upickle, but the size of the result doesn't please me - so I want to give boopickle a go, which should improve the serialisation roundtrip. I wonder if it can benefit from 1.4.0 typed array improvements?

Dave Smith
@davesmith00000
Thanks both, good to know. 👍
Anton Sviridov
@keynmol
If you do get round to benchmarking - let us know how it goes :)
Dave Smith
@davesmith00000
I will, though don't hold your breath, I'm still in the "gosh I hope this works at all" stage. 😉
Andriy Plokhotnyuk
@plokhotnyuk
@davesmith00000 @keynmol Here are results of parsing and serialization of different data types and message samples in browsers using different JSON libraries, including uPickle. Sources of benchmarks are here, and instructions how to build and run them are here. Feel free to try with your data structures and codecs.
Dave Smith
@davesmith00000
That's a great page, thanks! One slight wrinkle is that I'm trying to avoid macro based systems at the moment since I'm targeting Scala 2 & 3, so I'd need to be carefully about which libraries I used. The other thing is that I'm running on an assumption (always dangerous...) that although full serialisation would be easier (much!), it's probably heavier than a conversion to a native JS objects - no parsing for one thing.
Anton Sviridov
@keynmol
damn @plokhotnyuk that's awesome. I don't have no-macro requirements as Dave does, so I'll check out everything on that page and see how it works out for my particular usecase
Andriy Plokhotnyuk
@plokhotnyuk
@keynmol Cool! Any you feedback will be greatly appreciated! Also, if you can give a description of your usecase please share it in the project chat.
Sébastien Doeraene
@sjrd
All interested: should we create a gitter8 template for Scala.js? And if yes, what should it contain? scala-js/scala-js#4390
Martijn
@martijnhoekstra:matrix.org
[m]
I would love a g8 template that has a shared jvm/js lib project and a js web project, if at all possible cross-building with scala3
Anton Sviridov
@keynmol
I think it's a rad idea, so I put a few ideas on the issue
Hanns Holger Rutz
@Sciss
My understanding is that in 1.4 Array[Byte] will be represented by a typed-array, like Int8Array? Then, if I have an ArrayBuffer, is there a straight forward way to get an Array[Byte] without copying? Like is there a better way than doing new Int8Array(ab).toArray[Byte] (is that even correct?)?
Tobias Schlatter
@gzm0
@Sciss there isn't a way to do this without copying.