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
Fabio Labella
@SystemFw
by definition
your language is a Free monoid (a List) of commands, where each command describes assigning a value to something
it's perfectly referentially transparent (pure), because the definition that defines purity (replacing an expression by its bound value doesn't change behaviour), holds
Martijn Hoekstra
@martijnhoekstra
@mpickering scalac parses source code to syntax trees. In subsequent phases more information is added to those trees. The typer phase hangs types on the trees
it's all very Christmasy
Matthew Pickering
@mpickering
but it is all dynamically typed yes?
Fabio Labella
@SystemFw

I see your exmple, but what you did was show that you can interpret an impure language in a pure interpreter. Just because you can use pure programming to write an interpreter to interpret an impure program doesn't make the interpreter impure.

So, in the example, neither the language or the interpreter are impure, at all

Harrison Houghton
@hrhino
It's statically Trees. Most trees wind up with tpe (and symbol, if it makes sense) set after typer.
Some Tree subclasses don't show up before or after certain phases.
so it's pretty loosey-goosey like that.
Matthew Pickering
@mpickering
ok
Martijn Hoekstra
@martijnhoekstra
to the compiler, the types of your program are values, the types of your program are not types in the compiler
Matthew Pickering
@mpickering
@martijnhoekstra Yes but you can design a compiler so that the type of a typechecked AST is different to that of a parsed AST.
Harrison Houghton
@hrhino
Yes, ghc does that, for instance.
Martijn Hoekstra
@martijnhoekstra
it depends on who you mean by "you" -- if you mean me, then no :P
Harrison Houghton
@hrhino
Their tree is parameterized over the "name" type, which goes from RdrName (scalac's Name) to Name (a tuple of name/symbol/type) during typechecking.
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
it changes the meaning of certain trees like Const[A, ?]
Martijn Hoekstra
@martijnhoekstra
valid scala syntax that is
Harrison Houghton
@hrhino
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