cyrilou242 / jnotebook

Notebook for Java.
https://jnotebook.catheu.tech
MIT License
12 stars 3 forks source link

Recompute after cell update #21

Closed turiot closed 10 months ago

turiot commented 11 months ago

Hello, following our exchange on reddit, I think it's a very hard task to detect variables updates, for instance :

    var liste = new ArrayList<String>();
    var x = "x";
    liste.add(x);
    liste.get(0).toUpperCase();

    void method(Point point) {
       point.x = 5;
    }
    var p = new Point(10, 20);
    method(p);  

    method in a jar not analyzed by jshell

Using a "deepHashCode" to compare vars after snippet execution can be a solution, but with size limitations (huge collections or arrays).

Another option is to recompute the whole notebook, excepting snippets which previous executions was time consuming, asking advice to the user. This solution overlaps the restore of a saved notebook.

Maybe these options can coexist and be chosen by the user, according to his usage profile (java learning, api testing, data science, ...)

cyrilou242 commented 10 months ago

Hey,

I'm not sure to understand the example. Is this something that is not working as expected in the current implementation?

If not I'll move this to discussions.

Using a "deepHashCode" to compare vars after snippet execution can be a solution, but with size limitations (huge collections or arrays). Another option is to recompute the whole notebook, excepting snippets which previous executions was time consuming, asking advice to the user. This solution overlaps the restore of a saved notebook. Maybe these options can coexist and be chosen by the user, according to his usage profile (java learning, api testing, data science, ...)

turiot commented 10 months ago

Sorry, discussions was actually the place to post.