Code Monkey home page Code Monkey logo

Comments (3)

elordin avatar elordin commented on September 13, 2024 2

A long list of lines in jslib.js that use vanilla arrays as lists you say? Why of course I have that!

193 - used locally only
235
281 - used in websocket only
374 
411 - used in websocket only
424 - used in websocket only
525
719ff
752
908
925
931
935
952ff
1016
1066ff
1084ff
1096ff
1207ff
1321-1378
1392ff
1400ff
1445 - an especially weird one
1483
1490ff
1501ff
1616ff
1713
1791
1798ff
1810ff
1903ff
1933ff
1941ff
1964-2033
2136ff
2266ff
2362
2385
2438
2460
2587ff
2690-2691
2697
2773ff
2843ff
2955ff
2973ff
2994
3017
3050
3088ff
3273
3367ff
3799
3811
3821ff
3890ff

3160-3182 - uses the lsList

from links.

frank-emrich avatar frank-emrich commented on September 13, 2024

I've had the chance to look into this a bit.
Chanigng the translation of lists in irtojs.ml is easy. However, there exist two flavors of head and tail functions in jslib.js:
_lsHead and _lsTail act on linked lists, whereas hd and tl act on JS Arrays.
There are also other functions like min and max that act on JS Arrays in jslib.js.

However, changing these functions to operate on linked lists breaks all kinds of existing code, since the existing code passes JS Arrays to them. Together with Thomas I've had a look at where those JS Arrays come from (since after adapting irtojs.ml they do not (should not) come from translated IR code any more). It seems like they are created in many places in jslib.js, for example in the code dealing with events and XML. It's quite difficult to identify all the places where those lists are coming from, for example if lists are passed around as messages.
In addition, it may be desirable to continue using JS Arrays internally in some parts of jslib.js for the sake of performance, .e.g. when dealing with XML. It would then however be necessary to carefully document which functions in there use JS Arrays and which use linked lists.

Thus, should I try to do a full code review of jslib and identify all the instances where JS Arrays are created? I see no other way in order to get this task done properly.

from links.

jamescheney avatar jamescheney commented on September 13, 2024

Doing a thorough code review and rational redesign sounds like a good strategy to me, and a good way of learning (a substantial part of) the code. (This is also the case for several other parts of the code I can think of.) I think Sam, Daniel or Thomas know more about jslib and irtojs so their advice would be helpful regarding how to proceed.

from links.

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.