Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 18 19:06
    @sjrd banned @Amitgup48798297_twitter
  • Mar 29 07:47
    @sjrd banned @quangs
  • 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
Li Haoyi
@lihaoyi
lots of people have forked Scalatags when they needed more control (e.g. Scala-Js-React did, Slinky basically has a carbon-copy though not sure if it's a fork or re-write) so there's no harm or shame in doing so
August Nagro
@AugustNagro

@godenji I am working on a Scala 3 DSL using the new Context Functions. I'm really enjoying it so far.

@main def launchApp: Unit = shaka.render(ShoppingList("Odersky"))

class ShoppingList(name: String) extends Component:
  override def template: ComponentBuilder =
    import shaka.builders.{name as _, *}
    div{className("shopping-list")
      h1{t"Shopping list for $name"}
      ul{
        li{t"Scala 3 Books"}
        li{t"Scala.js Tutorials"}
        li{t"Cooking guides!"}
      }
    }

I've made a bunch of demos here: https://github.com/getshaka-org/shaka-docsite/blob/master/src/main/scala/org/getshaka/shaka/docsite/Demos.scala

It's not done yet (not published for Scala 3 and site is down), but check it out if you're interested: https://github.com/getshaka-org/shaka

N.S. Cutler
@godenji

Just know that it'll inevitably be even more poorly maintained than Scalatags already is!

ha, touché :)

You're rather prolific, and with that comes too much on one's plate I suspect. Just exploring some ideas around scala 3 + scala-js, so any markup solution will do the trick in the early stages.

N.S. Cutler
@godenji

@AugustNagro cool, interesting approach, my first instinct with scala markup builder would be to have the tag take a Seq of arguments and have 2nd param block receive the child tag block (e.g. something like: div(cls ~ "...", click ~ "..."){ h1{...} })

I'll take a look at your library, thanks.

August Nagro
@AugustNagro

@godenji In my first iteration I had a varargs param group for properties/styles exactly like you say. But performance is >100 times better without varargs, which create many allocations and cannot be inline'd

You can see the change in getshaka-org/shaka@2c84679.

With inlining, the fullLinkJS output for

div{color("purple"); t"Hello $user"}

Becomes

var b = document.createElement("div");
b.style.color = "purple";
b.appendChild(document.createTextNode("Hello "));
var c = this.Wo;
null !== c && void 0 === c ||
b.appendChild(document.createTextNode(c));
b.appendChild(document.createTextNode(""));
a.appendChild(b);

Which is quite good. So given the perf benefit it's a no brainer. I still use the DSL like HTML, with properties on the same line as the tag, and children in the indented region:

div{`class`("myCls"); id("abc"); otherProp(23)
  p{t"this is the body"}
}
N.S. Cutler
@godenji
@AugustNagro nice start, implement a router and you've got the makings of a native scala SPA framework :)
renghen
@renghen
hi to all
how do we write javascript generators in scala.js ?
Tobias Schlatter
@gzm0
No easy way to do it IIRC.
I'm trying to dig up the discussions we had how to type them.
PR for Iterable (without full generator typing): scala-js/scala-js#2784
This is the original PR: scala-js/scala-js#2110
(with relevant discussion)
nafg
@nafg
@renghen do you actually need to, or do you just want to achieve a similar result?
renghen
@renghen
I am doing some experiments around javascript and cps
I wanted to emulate the same thing on scala.js
Jacob Bogers
@Jacob_Bogers_twitter
is scala.js a good way to learn scala?
Lorenzo Gabriele
@lolgab
@Jacob_Bogers_twitter Scala on JVM and JS are mostly the same language. If you plan to use Scala on the frontend i'd say, why not?
I personally learned it on the JVM because I was coming from Java, if you're coming from a frontend/nodejs background I think starting with Scala.js is totally cool!
Jacob Bogers
@Jacob_Bogers_twitter
I know Java up to 6 (done it full time up to that point), I was a but put off by the toolchain, but maybe I am reading to much into things, yes, I would like to use scala front/backend all the way if possible
I will start with scala.js , super thanks
Lorenzo Gabriele
@lolgab
No worries, you can ask here or on Discord #scala-js if you have any doubt. I really like to have Scala.js full-stack. I currently use Google firebase on a toy project where everything is Scala.js (cloud functions and SPA) :)
rhazn
@rhanarion_twitter
Hello, I am having a look at compiling an existing lib with scala-js but running into an error setting up the testing framework ("SyntaxError: Unexpected token 'export'" as I configure ScalaJS to export an ESModule). Is there an easy way to turn of the testing for a start? I am not that familiar with sbt :/
Sébastien Doeraene
@sjrd
@rhanarion_twitter If you don't run the test command, it won't test. I'm not sure what you mean by "turn of the testing for a start"?
rhazn
@rhanarion_twitter
I have tests for scala that run when I use test. When I enable the scala-js plugin in the sbt file it also adds it's own tests to the test command. I would like to keep everything I have done (compile the scala lib to javascript) but keep the test command as it was (testing only scala code).
Sébastien Doeraene
@sjrd
Are you using a crossProject?
rhazn
@rhanarion_twitter
Not that I know of but my sbt knowledge is sadly limited.
Sébastien Doeraene
@sjrd
If you just have one project and you add an enablePlugins(ScalaJSPlugin) on it, then it's not a JVM project anymore. There's no JVM code to test.
If you want to keep the JVM part, you need to use a crossProject to build, in fact, 2 projects: one for the JVM and one for JS.

@renghen

I am doing some experiments around javascript and cps

Does https://github.com/scala/scala-async address your use case?

rhazn
@rhanarion_twitter
But if I run sbt package it still creates a jar file, what is in that file? :eyes:
Sébastien Doeraene
@sjrd
The thing that can be published for it to be used as a Scala.js library.
rhazn
@rhanarion_twitter
Ah, interesting.
renghen
@renghen
rhazn
@rhanarion_twitter
Mhm with cross building (from here https://www.scala-js.org/doc/project/cross-build.html) sbt does no longer find my annotations, even with scalajs-stubs in the jvm dependencies :/
Sébastien Doeraene
@sjrd
Shared code goes in the shared/ subdirectory by default. You may have to move your src directory inside shared/. Or use .crossType(CrossType.Pure) on your crossProject.
rhazn
@rhanarion_twitter
Ah I see
I think my grasp of the whole setup is a bit too small to make it work quickly so I'll have to shelf it for now
But thank you for the help, it made what happens a lot clearer already :thumbsup:
Kirill A. Korinsky
@catap
Any plans to release scalajs-dom for scala3?
Sébastien Doeraene
@sjrd
Probably not. The 2.13 version can be used. And if we publish a version for 3, then one could get both the 3 and 2.13 versions in the classpath through transitive dependencies, leading to bad issues.
On the other hand, it might be nice to look at how we could design a version 2.x of that library which would leverage Scala 3 features.
Nikita Gazarov
@raquo

one could get both the 3 and 2.13 versions in the classpath through transitive dependencies, leading to bad issues.

scala-js-dom aside, is this a concern for libraries that are cross published for 2.13 and 3.0.0 with the same codebase (not scalaVersion-specific)? If so, what would the symptoms be, the usual binary incompatibility errors like "non-existent method"?

Sébastien Doeraene
@sjrd
Yes, that is the most likely symptom.
Kirill A. Korinsky
@catap
@sjrd one future question: dose somebody working on biginteger inside sjs?
Sébastien Doeraene
@sjrd
What do you mean? We have BigInteger in Scala.js. Nobody's "working on it"; it's done already.
Kirill A. Korinsky
@catap
thanks
Rich
@Rich2
So this could be my error, as its the first time I've tried to build a Scala.js artifact under Scala 3, but I'm getting
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "1.1.0",

not found: /home/rich/.ivy2/localorg.scala-js/scalajs-dom_sjs1_3/1.1.0/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/scala-js/scalajs-dom_sjs1_3/1.1.0/scalajs-dom_sjs1_3-1.1.0.pom
Anton Sviridov
@velvetbaldmime:matrix.org
[m]

@Rich2 scalajs-dom is not published for Scala 3, but it works fine with using a 2.13 version.

Which version of SBT are you using?

Rich
@Rich2
I'm on 1.5.2.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]

("org.scala-js" %%% "scalajs-dom" % "1.1.0").cross(CrossVersion.for3Use2_13)

Should get you there then :)