Giter Site home page Giter Site logo

Comments (5)

algobardo avatar algobardo commented on May 22, 2024

I think the right change would rather be on the ReversePowersetLattice.
Note that the approach of using the characteristic function still allows you to pass a Set to construct the lattice as Set[A] extends (A) => Boolean: http://www.scala-lang.org/api/2.12.3/scala/collection/Set.html

from tip.

DIvanov503 avatar DIvanov503 commented on May 22, 2024

I take your point. On the other hand, Idea doesn't seem to recognize the type A if I just replace s: Set[A] by ch: A => Boolean in the ReversePowersetLattice, e.g., it complains about the AvailableExpAnalysis and doesn't compile. Adding asInstanceOf operators fix the problem but it doesn't seem to be a good style. However, I'm a Scala novice and might have missed an elegant way of solving it.

By the way, I'm curious whether there exists a use case where defining a lattice over a subset of a type, that itself does not form a type, is needed.

from tip.

DIvanov503 avatar DIvanov503 commented on May 22, 2024

Quickfix: replacing s: Set[A] by ch: A => Boolean works well for my reaching definitions analysis implementation. However, there are still typing warnings from Idea that can be eliminated by asInstanceOf. And it requires explicit construction of the bottom element in the ReversePowersetLattice.

from tip.

algobardo avatar algobardo commented on May 22, 2024
  • As for the use case, having something to pass when constructing the object save us from annotating the generic type. Moreover if you want to be pedantic/defensive the powerset lattice implementation coud check that the lub operation is performed on sets that are subset of the one denoted by ch

  • As for the Idea warnings, Idea scala plugin is not as clever as the scala compiler. You have to live with them. I think there is some work going on for making a Language Server for giving the editors compiler info, but I guess we have to wait for that.

from tip.

DIvanov503 avatar DIvanov503 commented on May 22, 2024
  • Thank you! The lub return was one of my concerns as well.
  • Thanks for clarification!

from tip.

Related Issues (13)

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.