Giter Club home page Giter Club logo

leucine's People

Contributors

ansvonwa avatar devlaam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ansvonwa

leucine's Issues

RecursionOverflow during compilation of library with matched Option.

In the code we have the following remarkable issue. This compiles:

/** Register this actor. */
private[actors] override def register(prename: String): String =
  parent.map(_.adopt(prename,self)).getOrElse(super.register(prename))

whereas this does not:

private[actors] override def register(prename: String): String =
  parent match
    /* Children register at the parent. */
    case Some(p) => p.adopt(prename,self)
    /* If this is the root of the family then we register at the guard. */
    case None    => super.register(prename)

with the error

dotty.tools.dotc.core.RecursionOverflow: Recursion limit exceeded.
Maybe there is an illegal cyclic reference?

I have no idea why. Should those forms not be equivalent? I have seen this effect over several Scala versions now, but I was not able to isolate it.

This issue does not influence the use of the library.

Deduce type of Receive that is based on match type?

In the code i make use of isInstanceOf and asInstanceOf:

  /* Deliver the letter in the envelope. */
  private[actors] final def deliverEnvelope[Sender >: Common <: Accept](envelope: Env[Sender], state: State): State =
    /* Let the letter be processed */
    val received = receive(envelope.letter,envelope.sender)
    /* The state remains unchanged, if we work stateless, otherwise compute the new state.
     * TODO: Can this also be solved compile time? In an elegant manner?
     * Based on this: https://scastie.scala-lang.org/13dD1LD8Q3OUpLrn89oLqw? */
    if received.isInstanceOf[Unit] then state else received.asInstanceOf[State => State](state)

This could of course also be done with a match construction, but i'd rather have something that is tied to the type of Receive itself. Is this possible, given that Receive is defined like:

type Receive = State match
  case Actor.State.Default.type  => Unit
  case Actor.State               => (State => State)

Is this possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.