com-lihaoyi / castor Goto Github PK
View Code? Open in Web Editor NEWCastor is a lightweight, typed Actor library for Scala and Scala.js
Castor is a lightweight, typed Actor library for Scala and Scala.js
scheduleMsg
is missing for scalajs. Adding issue so someone with time can implement. =)
Found above comment by @lolgab
I created a pool actor (basic actor) which internally uses another N basic working actors which do the processing round-robin. After all items to process were sent to the pool, I sent an "end-of-work" marker for each working actor with the assumption that they are handled last (after the last item sent) by the actor. When the end marker was received, the actor would countdown a latch and I can then wait for the pool to be finished with all items when the latch is done for all actors. This did not work as expected - only if I add a delay after the item sending phase (~ 100ms) the "end-of-work" markers are in order. Without the delay, the end-markers got handled before some items and that of course crashed the semantics. Is this intended? What am I missing here?
I'm unable to instantiate a castor Context for Scala.js. My minimal example doesn't even include an actor yet:
package ca.bwbecker
object Main {
implicit val ac = castor.Context.Simple.global
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
The fastOptJS
stage throws about half a dozen instances of the following error:
sbt:castorTests> fastOptJS
[info] Fast optimizing /Users/bwbecker/temp/castorTests/target/scala-2.12/castortests-fastopt
[error] Referring to non-existent class java.util.concurrent.ExecutorService
[error] called from private castor.Context$Simple$.executionContext$lzycompute()scala.concurrent.ExecutionContextExecutorService
[error] called from castor.Context$Simple$.executionContext()scala.concurrent.ExecutionContextExecutorService
[error] called from private castor.Context$Simple$.global$lzycompute()castor.Context$Simple
[error] called from castor.Context$Simple$.global()castor.Context$Simple
[error] called from constructor ca.bwbecker.Main$.<init>()void
[error] called from static ca.bwbecker.Main.main([java.lang.String)void
[error] called from core module module initializers
[error] involving instantiated classes:
[error] castor.Context$Simple$
This is with SBT. Plugins:
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.0")
Build file:
testFrameworks += new TestFramework("utest.runner.Framework")
lazy val demo = project
.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(
name := "castorTests",
scalaJSUseMainModuleInitializer := true,
version := "0.1",
scalaVersion := "2.12.13",
libraryDependencies ++= Seq("com.lihaoyi" %%% "utest" % "0.7.7" % "test",
"com.lihaoyi" %%% "castor" % "0.1.7"
)
)
Any suggestions?
Also, could you publish against a more recent version of ScalaJS?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.