Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 01 01:23
    darkfrog26 opened #55
  • May 01 01:23

    darkfrog26 on scalatest-3.2.12

    Update scalatest to 3.2.12 (compare)

  • Apr 17 01:02
    darkfrog26 opened #54
  • Apr 17 01:01

    darkfrog26 on scala3-library-3.1.2

    Update scala3-library, ... to 3… (compare)

  • Apr 10 01:00
    darkfrog26 opened #53
  • Apr 10 01:00

    darkfrog26 on sbt-scalajs-1.10.0

    Update sbt-scalajs, scalajs-com… (compare)

  • Mar 26 16:21

    darkfrog26 on 4.0.8

    (compare)

  • Mar 26 16:21

    darkfrog26 on master

    Release 4.0.8 (compare)

  • Mar 26 16:11

    darkfrog26 on master

    Update sbt-scala-native-crosspr… Merge branch 'master' into upda… Merge pull request #52 from out… (compare)

  • Mar 26 16:11

    darkfrog26 on sbt-scala-native-crossproject-1.2.0

    (compare)

  • Mar 26 16:11
    darkfrog26 closed #52
  • Mar 26 16:11
    darkfrog26 synchronize #52
  • Mar 26 16:11

    darkfrog26 on sbt-scala-native-crossproject-1.2.0

    Update scala3-library, ... to 3… Update scalatest to 3.2.11 Update sbt to 1.6.2 and 11 more (compare)

  • Mar 26 16:10

    darkfrog26 on auxlib-0.4.4

    (compare)

  • Mar 26 16:10

    darkfrog26 on master

    Update auxlib, javalib, nativel… Merge branch 'master' into upda… Merge pull request #51 from out… (compare)

  • Mar 26 16:10
    darkfrog26 closed #51
  • Mar 26 16:10
    darkfrog26 synchronize #51
  • Mar 26 16:10

    darkfrog26 on auxlib-0.4.4

    Update scala3-library, ... to 3… Update scalatest to 3.2.11 Update sbt to 1.6.2 and 8 more (compare)

  • Mar 26 16:10

    darkfrog26 on sbt-sonatype-3.9.12

    (compare)

  • Mar 26 16:10

    darkfrog26 on master

    Update sbt-sonatype to 3.9.12 Merge pull request #50 from out… (compare)

Matt Hicks
@darkfrog26
It should possible to add asynchronous calculation if it's desired, but unless you're doing heavy operations, I can't imagine it makes much difference
Marek Mosiewicz
@marekmosiewicz
Yes I mean one element depending on another
I try to find solution for Adempiere ERP. It has expression language which it parse and find dependecies, but is very primitive. Just thought that with TASTy maybe it is possible to find dependecies for expression (I need business user friendly expressions)
Matt Hicks
@darkfrog26
Reactify actually works at runtime in version 4 instead of compile-time. Earlier versions used Macros, but this led to complexities for users of the libraries depending how it was used.
Marek Mosiewicz
@marekmosiewicz
@darkfrog26 Macros in Scala3 claims to be standarized
Matt Hicks
@darkfrog26
it's not quite that simple
Marek Mosiewicz
@marekmosiewicz
@darkfrog26 Is it possible to detect dependencies without macro ?
Matt Hicks
@darkfrog26
Macros in Scala 2 or 3 require compile-time injection, but you may leverage pre-compiled functionality
yeah, that's what Reactify does
just call the references method on Val or Var

So, for example:

val a = Var("One")
val b = Var("Two")
val c = Var("Three")

val list = Val(List(a, b, c))

if I call:
list.references it should contain a, b, and c

in a more complex scenario:

val v1 = Var(10)
val v2 = Var("Yes")
val v3 = Var("No")
val complex = Val[String] {
    if (v1 > 10) {
      v2
    } else {
      v3
    }
}

complex.references will contain v1 and v3 initially, but if you change v1 to have a value greater than 10 it will have v1 and v2

Marek Mosiewicz
@marekmosiewicz
But how you can obtain it :) ?
Matt Hicks
@darkfrog26
what do you mean? references method returns a Set[Val[_]]
Marek Mosiewicz
@marekmosiewicz
I'm not good at Scala. how 10, v1 and v2 is put in references
Matt Hicks
@darkfrog26
How does it work you mean?
Reactify could technically be written in Java. There's nothing about Scala that makes it possible.
Marek Mosiewicz
@marekmosiewicz
I understand Observable/Observer but you need to set dependencies for object
What I was thinking of is to detect references from code automatically
Matt Hicks
@darkfrog26
The "magic" of how Reactify works is solving exactly this problem. In Val(List(a, b, c)), the parameter to Val is actually a function.
Internally, before evaluating that function, I set a ThreadLocal reference to the Val being evaluated. As the function is then being evaluated, any Val or Var that is gotten calls to the ThreadLocal to let it know it was referenced during the evaluation. This is how it determines the list of references.
Marek Mosiewicz
@marekmosiewicz
But what about Val/Var that is not evaluated because of condition not match. I mean v3 is not evaluated if v1 < 10
e.g. ( if(v1 >10 and vx< 20) will not evaluate vx
Matt Hicks
@darkfrog26
Right, but during the "evaluation" when any of the dependencies (v1 and v2) change, the function is then re-evaluated and a new dependency list is generated.
this is why I evaluate the list of dependencies, so I can listen for changes to them to know if I should re-evaluate
so, during re-evaluation, it determines that now v1 and v3 are now being referenced instead of v1 and v2, so it stops listening to v2 and starts listening to v3
Marek Mosiewicz
@marekmosiewicz
What about plugable references resolver. I mean it does not seems to be very complicated to list Vals from TASTy
Matt Hicks
@darkfrog26
after all, until v2 is being utilized to determine the result, it's just a waste of performance to listen to it
you can, but imagine this scenario:
Marek Mosiewicz
@marekmosiewicz
ok i understand.
smart
Matt Hicks
@darkfrog26

in Project A I create:

def getValue(): Int = a + b + c  // presuming those are three `Val`s

then, in Project B I do:

val value = Val(getValue() + d) // presuming d is a `Val`
if I were to use Macros I would never get a reference for a, b, and c because TASTy would not know in Project B anything except that I'm calling getValue() because it's already compiled
the way I wrote Reactify, this isn't a problem
There's a reason Reactify is on version 4. I've re-written it several times to get to where I am today. Two of the past major re-writes used Macros.
Marek Mosiewicz
@marekmosiewicz
I think with Scala 3 macro you could do this and even without Val/Var just writing something like expr(a+b+c) where expr is macro
Matt Hicks
@darkfrog26
Sure, but it requires a deeper understanding by the user of the library to do so, which creates pitfalls for someone that attempts the former and begins pulling their hair out when they can't conceive why it's not working as they think it should.
Marek Mosiewicz
@marekmosiewicz
Maybe you are right
Marek Mosiewicz
@marekmosiewicz
It sounds good. Have you heard of ADempiere https://github.com/adempiere/adempiere
Matt Hicks
@darkfrog26
nope, but their site is down
Marek Mosiewicz
@marekmosiewicz
It is war between contributors, but it has interesting ideas there. I would like to rewrite core for general purpose business app framework
Matt Hicks
@darkfrog26
seems like a crazy monolithic library
Marek Mosiewicz
@marekmosiewicz
In fact you can define model and forms in ADempiere in declarative way
Sakib Hadžiavdić
@sake92
Hello! How should I implement a debounce operation? Some kind of throttling of speed
I am only using it in scalajs if that matters
Matt Hicks
@darkfrog26
@sake92 well, you can do it in many ways but there's not anything currently built-in for that. There used to be in a much earlier version, but in 4.x I trimmed down the library to be slim and focused on a single problem.
if you find a good solution that would benefit by being a part of the library, I'd be happy to consider merging it in
you might look at adding a Reaction and using ReactionStatus for debounce to reject early changes?
Sakib Hadžiavdić
@sake92
Thanks for pointers, I'll try to make it working.