Git Product home page Git Product logo

Comments (8)

andys8 avatar andys8 commented on July 30, 2024 1

When talking about infinite recursion: There is bad-recursion.md in the elm-compiler repository where @evancz describes what the compiler is currently doing. Quite an interesting read, if you don't know it already.

Elm will allow recursive definitions as long as there is at least one lambda before you get back to yourself. [..] Anyway, I just thought it was cool that we cannot solve the halting problem in general, but a simple rule about lambdas can detect the majority of bad cases in practice.

from elm-analyse.

andys8 avatar andys8 commented on July 30, 2024

It would be especially intersting if it's not tail recursive.
But recursion in general is not something that has to be fixed, right? So why do we want to have a warning?

from elm-analyse.

halohalospecial avatar halohalospecial commented on July 30, 2024

@andys8 You're right, the title was misleading. I was aiming for just an indicator like in the screenshot. The project owner can freely close this issue if it's out of scope :)

from elm-analyse.

andys8 avatar andys8 commented on July 30, 2024

How about suggesting this feature with a visible indicator to the creators of the IDE plugins? For example VScode or Elmjutsu for Atom

from elm-analyse.

stil4m avatar stil4m commented on July 30, 2024

@andys8, the issue was created by the author of Elmjutsu :).

As for now, I want the violations in elm-analyse to be kept to "things that you do not want to have in your project", instead of "context-dependent bad".
Having the first property will decrease the need for issues such as #92, and increases the use of elm-analyse in combination with CI.

So, if this will be implemented, is there a well-known algorithm to detect if it is not tail-recursion?
I'm not really familiar with it.

from elm-analyse.

andys8 avatar andys8 commented on July 30, 2024

Haha, I didn't know that. So I basically advised @halohalospecial to do it on his own ^^ By the way, great plugin @halohalospecial :)

from elm-analyse.

halohalospecial avatar halohalospecial commented on July 30, 2024

My initial thought was to have indicators to remind the devs that there are calls that may cause infinite recursions (which will only appear in production). They may not be aware that calls are recursive (e.g. function A calls function B, which calls function C, which calls function A), or they may have written the incorrect function names (which they expected to be non-recursive). The compiler doesn't notify them of these scenarios.

I understand that this feature may be out of scope since it is context-dependent and not really a bad practice. It will just tell the devs to be wary about certain parts of the code and make sure that they really want recursion in those parts.

I'll ask Elmjutsu's creator if he is willing to implement this 😆

from elm-analyse.

halohalospecial avatar halohalospecial commented on July 30, 2024

Thanks for the link, @andys8!

from elm-analyse.

Related Issues (20)

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.