Live data from Hacker News

JavaScript right on the hardware

technical.io

91–100 of 320 posts

Re: JavaScript right on the hardware

#91
post #47

Javascript doesn't support integers, so it doesn't seem like a good language for programming low level hardware. What about bit manipulation (XOR, AND, Shifting, etc)? This is critical for a lot of serial data communications and I/O controls.

Javascript has the normal (C syntax) set of bitwise operations that operate on 32 bit numbers.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re: JavaScript right on the hardware

#92
post #73
post #36

Earlier quoted context omitted.

No. I prefer C over JavaScript for embedded devices. And actually in most places, too. I know I'm weird, but I really like pointers, because I really like being able to manually setup data structures, and enjoy the power provided by pointers. Manual memory management isn't horribly fun, but for embedded devices I would rather be in charge of that over the chip having to do it for me. It means that if there's ever a m…

Sure if you write very low level stuff, C is probably more suitable. I wonder how much today's "embedded devices" still have in common with traditional embedded devices, though? If it is capable of running JavaScript, it probably is a lot more powerful than some microprocessor with just 2KB RAM where you have to squeeze every bit out of your code. On the PI you can run a complete Linux installation. I don't think the…

JavaScript, and scripting languages in general (and, to be more specific, dynamically typed languages, too, but those tend to be scripting languages, anyways) tend to have a lot of gotchas, and when it comes to controlling physical things, I think that less gotchas are better.

Yes, statically typed languages just put a bunch of metadata in the code, but I think it's useful to have the guarantees provided by a static type system when your controlling things.

Like if you're controlling a robot arm. I'd rather have the type system make sure I don't try to do something stupid, like add a string to an int that's controlling the degree of the arm. Static languages make sure you can't do that, most dynamic language will let you do that.

Re: JavaScript right on the hardware

#93

Forgive me for not being hip but why try so hard to put JS in new places? It seems to be just an unfortunate historical accident that JS is one of the most popular languages in the world - does anyone actually like it compared to other modern scripting languages? Could we invest in CoffeeScript instead, at the very least?

When I see a device like this I like to think that people familiar with JS can now tinker with hardware devices. I know some people who are comfortable with JS but aren't engineers and they may not be willing to learn Arduino C.

Whatever language it is I'm glad prototyping devices are coming out at a cost that basically makes them an impulse purchase.

Re: JavaScript right on the hardware

#94
post #80

Earlier quoted context omitted.

Why it's always C/C++ (not even Pascal or Oberon) in another corner of the ring? If hardware is powerful enough to sustain Node.JS, why not use OCaml, Racket or, maybe, some JVM-based language? Or, if the scripting is a requirement, Lua, Tcl or maybe Python.

Because a lot of people know Javascript and C/C++.

Okay, maybe Racket and OCaml are relatively obscure options, but quite a lot of people know Java and Python. And I can't say Lua's not popular, too.

Re: JavaScript right on the hardware

#95
post #86

Earlier quoted context omitted.

Because everyone* knows JavaScript. I'd wager that the vast majority of professional software engineers work on the web, or very close to the web, and JavaScript is the lingua franca of the web. I mean just look at the front page of Hacker News on any given week. It's full of talk of JavaScript and new JavaScript libraries and new things to do in JavaScript. When you think about how many more people this can reach wi…

Very nice analogy (the lingua franca ). The state of CS and the convergence we're seeing toward the web worries me though.

Can I ask why it worries you? Honestly just curious. Is it the performance hits of more levels of abstraction? Or fear of all data being in the "cloud"?

Re: JavaScript right on the hardware

#97
It would be interesting to see scheme implemented in hardware, complete with primitives intended to be wired to low-level pointer manipulation functions. Further, it would be interesting to see someone seasoned in low-level C sit down with a copy of Lion's Unix Commentary and the NetBSD sources and attempt to implement a minimal Unix atop the scheme hardware using only said hardware's scheme dialect ("SysScheme"?).

Re: JavaScript right on the hardware

#98
post #71

Earlier quoted context omitted.

I would have thought this was obvious, but orders of magnitude more developers know Javascript than Lua[1], thanks largely to the popularity of browsers as a programming environment. According to some recent research[2], the three primary factors affecting the adoption of a programming language by developers are, in this order: 1. Libraries available 2. Familiarity 3. Performance And per the paper, this order of pref…

I think JavaScript might be most successful on Arduino for the same reason - it's a platform with which most tinkerers are familiar. http://blog.safaribooksonline.com/2013/07/16/javascript-powe...

I suspect Arduino (at least the ones I've used, Uno?) are a bit underpowered for higher level managed languages like JavaScript.

Re: JavaScript right on the hardware

#99

It would be interesting to see scheme implemented in hardware, complete with primitives intended to be wired to low-level pointer manipulation functions. Further, it would be interesting to see someone seasoned in low-level C sit down with a copy of Lion's Unix Commentary and the NetBSD sources and attempt to implement a minimal Unix atop the scheme hardware using only said hardware's scheme dialect ("SysScheme"?).

So, lisp machines of the 80s?

Re: JavaScript right on the hardware

#100
post #99

It would be interesting to see scheme implemented in hardware, complete with primitives intended to be wired to low-level pointer manipulation functions. Further, it would be interesting to see someone seasoned in low-level C sit down with a copy of Lion's Unix Commentary and the NetBSD sources and attempt to implement a minimal Unix atop the scheme hardware using only said hardware's scheme dialect ("SysScheme"?).

So, lisp machines of the 80s?

No, scheme machines of the 10s.
Post reply on HN