Hacker News new | ask | show | jobs
by throwawaymaths 915 days ago
> We believe JavaScript, instead of Python, could act as an ideal language for expressing mathematical ideas if the proper infrastructure existed

Outside of "everyone uses js", why do we believe this? What makes JS "ideal".

I would think for machine learning one would want:

- generally default to non-mutating, functional representation of ideas, with convenient escape hatches

- treats the GPU as a concurrent (or better yet, distributed) resource

- can seamlessly run ML code as either immediate or an optimized graph.

- could swap out compute resources as asynchronous rpc, like, flex out to something more powerful if available and needed

Certainly most of these are possible in JS, but I would hardly call it "ideal" for these bullet points, not to mention other general concerns like a highly questionable dependency management ecosystem.

4 comments

JS lives where you visualize and explore data, so making it better at processing data would be a big win for workflows.

When you use a jupyter notebook the kernel wastes a lot of resources on visualization and the support for interactive visualization isn't ideal (copy all your data to json, pass that to a JS library which has to do the work).

Take a look at ObservableHQ for an idea of what an interface might look like, then imagine numpy semantics and webGPU on top.

As a bonus: run on server or in browser locally would reduce cloud bills because you don't need a whole server to do an exploratory analysis.

There is a TON of sunlight between "better than python" and "ideal"
I'd love to use JS instead of Python for math/numerical stuff for many reasons, but without operator overloading it's just hell.
Interestingly I dislike Python for the exact same reason. Every time I look at a PR, I second guess every single operator and index. Does this attribute access carry a heavy penalty or side effects? Etc. I find it adds a large mental overhead to any given piece of code.
Side effects on operator overload or attribute read are just really bad practice and is very rarely done. Do you second guess every identifier in C because it could be a preprocessor macro?

Yeah, stupid overloading like C++ IO is a mess, but I haven't encountered much such abuse in Python.

Fair points. I do find the scope of C macros to be far narrower than overloading, but you are right.
The usage of the word "ideal" in the 2021 post was probably not ideal :)

The accessibility and diverse ecosystem of JavaScript, owing to its status as the lingua franca of software development, would probably be the basis for it being "ideal". I think it would be hard to make an objective claim that one programming language is strictly better than another as a programming language for mathematical ideas.

> lingua franca of software development

s/software/web/

probably just rushed writing. the Deno team are smart, I imagine they know there are better languages than JS for these sort of problems (technically)

giving them the benefit of the doubt, perhaps they mean is that it's ideal having these capabilities accessible in JS since it can be run (almost) everywhere and there are a ton of developers who know JS