Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 00:10
    som-snytt commented #12463
  • Sep 16 19:17
    steinybot opened #2184
  • Sep 16 18:26
    SethTisue commented #2172
  • Sep 16 18:25

    SethTisue on main

    Simplify the example used for c… (compare)

  • Sep 16 18:25
    SethTisue closed #2172
  • Sep 16 18:25
    SethTisue reopened #2172
  • Sep 16 17:50
    vlulla closed #2172
  • Sep 16 14:53
    lrytz edited #12463
  • Sep 16 14:53
    lrytz milestoned #12463
  • Sep 16 14:53
    lrytz assigned #12463
  • Sep 16 14:53
    lrytz labeled #12463
  • Sep 16 14:53
    lrytz opened #12463
  • Sep 16 12:59
    retronym labeled #9761
  • Sep 16 08:51
    scala-jenkins milestoned #9761
  • Sep 16 08:51
    lrytz review_requested #9761
  • Sep 16 08:51
    lrytz opened #9761
  • Sep 16 05:39
    nwk37011 synchronize #9752
  • Sep 16 05:38
    nwk37011 synchronize #9752
  • Sep 15 20:28

    SethTisue on 2.12.x

    2.12: new Scala SHA (post-2.12.… (compare)

  • Sep 15 20:28
    SethTisue closed #1485
Matthew Pickering
@mpickering
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?
Fabio Labella
@SystemFw
any link?