Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 16:31
    som-snytt commented #8039
  • 11:59

    lrytz on 2.12.x

    Avoid `case _: C[_]#K` type tes… Merge pull request #9762 from l… (compare)

  • 11:59
    lrytz closed #9762
  • 11:44
    tgodzik commented #9761
  • 09:18
    lrytz synchronize #9762
  • 09:06
    scala-jenkins milestoned #9762
  • 09:06
    lrytz review_requested #9762
  • 09:06
    lrytz opened #9762
  • 08:36
    lrytz commented #12463
  • 08:33
    joroKr21 commented #12463
  • 08:27
    lrytz commented #12463
  • 08:27
    lrytz commented #12463
  • 07:48
    nwk37011 synchronize #9752
  • 07:39
    nwk37011 synchronize #9752
  • 07:33

    lrytz on 2.12.x

    Fix range position end for infi… Merge pull request #9761 from l… (compare)

  • 07:33
    lrytz closed #9761
  • 07:33
    nwk37011 synchronize #9752
  • 07:33
    lrytz commented #9761
  • 05:58
    nwk37011 synchronize #9752
  • 00:10
    som-snytt commented #12463
Matthew Pickering
@mpickering
I was trying to understand how plugins could possibly work but now it makes sense
As I understand it though, the "parser" phase always has to come first because that takes a string as an argument rather than a CompilationUnit.
But https://github.com/non/kind-projector claims to extend the syntax?
Seems to actually run after parsing so doesn't extend the syntax
Martijn Hoekstra
@martijnhoekstra
it probably hooks in to the names it considers special
Harrison Houghton
@hrhino
Kind projector doesn't actually extend the lexical syntax
it's all "valid scala" before it runs
Martijn Hoekstra
@martijnhoekstra
valid scala syntax that is
Harrison Houghton
@hrhino
it changes the meaning of certain trees like Const[A, ?]
Right
Matthew Pickering
@mpickering
right, that's how I imagined it actually worked but the plugins page seemed to suggest otherwise
I'm less interested now :P
Harrison Houghton
@hrhino
haha
there's a lot you can do by manipulating parsed-but-not-yet-typed trees.
Martijn Hoekstra
@martijnhoekstra
Maybe I can interest you in a lovely pre-owned sausage maker
Matthew Pickering
@mpickering
Are there any mechanisms to affect type checking? To make more programs compile than would otherwise? (But not by hacking around in the parser <-> renamer phase)
Harrison Houghton
@hrhino
There's AnalyzerPlugin.
That lets you adjust the types of trees.
You can't completely replace typechecking (nor, I think, can you suppress type errors), though
Matthew Pickering
@mpickering
thanks, useful to know
looks like there's lots of useful scala plugins
srimugunthan
@srimugunthan
whats the best way to cancel a future in scala?
Josh
@joshlemer
you cant cancel a future in general
Martijn Hoekstra
@martijnhoekstra
scala Future has no facilities for cancellation
Gavin Bisesi
@Daenyth
There are other task abstractions that support it, like cats-effect, but they're a bit different and you'd need to adapt some bits
trepidacious
@trepidacious
Does any equivalent of Future have a non-cooperative cancellation feature? I mean one that doesn't rely on the code in the Future having some kind of polling for cancellation?
Martijn Hoekstra
@martijnhoekstra
You can build an API on top that cancels at flatMap boundaries
Derek Wickern
@dwickern
you can cancel between each continuation... otherwise you would need cooperation
trepidacious
@trepidacious
Yup if the contents are interpreted
I've not looked into continuations
Derek Wickern
@dwickern
it would help if you have low-level cancellable primitives
like an http client with cancellable requests
trepidacious
@trepidacious
Yes
Derek Wickern
@dwickern
and a cancellable traverse, etc
trepidacious
@trepidacious
It's funny that the even on a VM there isn't a safe way to stop a thread or something like a thread
Martijn Hoekstra
@martijnhoekstra
you will probably always need cooperation
Seth Tisue
@SethTisue

whats the best way to cancel a future in scala?

relevant: https://viktorklang.com/blog/Futures-in-Scala-protips-6.html

Fabio Labella
@SystemFw

@trepidacious

or something like a thread

Depends on what you consider "something like a thread"

a cats-effect Fiber can be interrupted
although obviously you are still limited by the JVM, i.e. if you build your stuff as F.delay { huge block } you still can't do much about it
trepidacious
@trepidacious
@SystemFw Ah that's cool, I'll have a look. I was thinking about the huge block case - I guess if the block is pure, it should theoretically be possible to just stop it dead without problems, but there's no actual way of doing that?
Martijn Hoekstra
@martijnhoekstra
if the block is pure, it should theoretically be possible to just stop it dead
it's very difficult to define what "it" is in that sentence
Fabio Labella
@SystemFw
very fine grained interruption needs fine grained control of evaluation as well
for example the Haskell runtime uses the points in which the code yields to the garbage collector (which happens often due to the interaction with laziness) as yield points for concurrency as well
once you start thinking about interruption from an implementor point of view
which we had to do a lot in cats-effect
you'll see that "just stop it" is one of the those things that seems very straightforward on paper, but that it isn't at all
Josh
@joshlemer
Did you guys look at "pull-based" futures that Rust has?