Live data from Hacker News

JavaScript right on the hardware

technical.io

121–130 of 320 posts

Re: JavaScript right on the hardware

#121
post #54

Earlier quoted context omitted.

I don't have much problem with programming an embedded device in a high-level language, but why JS specifically? Why not Lua, which just as fast, and is better than javascript in many respects?

Slightly off topic, but is it just me or has Lua gotten a lot of attention on HN in the past weekish? I haven't heard much of Lua before but recently it seems to have come up a lot more. And even more off topic (sorry), what makes Lua better/different than other scripting languages? EDIT: On jacobwcarlson suggestion, I Googled Lua vs Python, and found this Wiki, http://lua-users.org/wiki/LuaVersusPython Not a speed c…

Lua is a language designed to be embeddable, Javascript is a language that didn't even had the chance to be properly designed.

Although I'm one of those Lua "unadopters", for me it's better to simplify stuff to my audience, and I have considered seriously to use JavaScript for my next project instead of Lua.

Re: JavaScript right on the hardware

#122

This is very cool, but I don't see how it can compete with boards like the BeagleBone Black. The BleagleBone Black is $45 for a 1GHz CPU and 512 MB of memory, yet the access to low-level hardware is just as good.

Looks like the JavaScript bindings for Tessel are better. Comparing the demo for blinking an LED: var b = require('bonescript'); var state = 0; b.pinMode("USR3", 'out'); setInterval(function() { state = state ? 0 : 1; b.digitalWrite("USR3", state); }, 100); vs var tessel = require('tessel') tessel.led(1).blink() If they can give human-friendly names to stuff like "USR3" and "P9_40" and "P9_36" out of the box, then I'…

And what happens when you need to specify a pin mode on the Tessel? If you don't have at least tri-state support (which isn't compatible with human-friendly abstractions like "blink"), you're going to burn out a lot of sensors.

Most modern microcontrollers have anywhere from 3 to 5 possible pin states, and I don't think it's possible to safely wrap these up in a nice, human-friendly function like "blink".

For example, on a lot of ARMs, you have:

In, no pull

In, pulled up

In, pulled down

Out, up

Out, down

and on AVRs, you have

In, no pull

In, pulled up

Out, up

Out, down

You necessarily have to have ugly secondary functions like "pinMode".

Re: JavaScript right on the hardware

#123

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?

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…

I may know javascript, but my god I wish I didn't have to.

Re: JavaScript right on the hardware

#124

I feel sorry for the people who need this.

You know when people talk about negativity in Hacker News comments? This is what they mean.

Not sure what you mean by that. I meant exactly what I said: I feel sorry for anyone whose linguistic toolbox is so limited that Javascript is their best option for writing low-level code for manipulating electronic devices. It is hard to imagine a more profound mismatch between the tool and the problem it is supposed to solve.

Re: JavaScript right on the hardware

#125
post #28

First off, this is cool. It is tremendously exciting to see the bar for hardware hacking getting lower and lower. To the people complaining "Why JS? C is fine!", remember that once the complaint was "Why C? ASM is fine!". At the same time, I can't help but grin that we on the CS side find a way to erase all the gains in performance and efficiency as soon as the EE guys make them. There has to be come kind of universa…

At the same time, I can't help but grin that we on the CS side find a way to erase all the gains in performance and efficiency as soon as the EE guys make them.

This is a long-noted phenomena. The old saying that summed it up was, "Andy giveth, Bill taketh away." (Referring to Andy Grove of Intel and Bill Gates of Microsoft.)

Re: JavaScript right on the hardware

#126

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?

why try so hard to put JS in new places?

Because its the current trendy thing. And chasing that dragon isn't necessarily a bad thing if it gets people in the door. Sure its an evolutionary dumb step in some ways but lowering the barrier to entry means that ideas that might not otherwise come to the space could get a chance to grow. Or if nothing else the trendy attention means more libraries get written, which helps someone else down the road.

There are a lot of blind optimism in that statement, but we all know that the best tech doesn't win. What wins is the good enough-ist tech that also pops enough buzzwords win the to interest of the dude that claims to only care about the best tech.

Re: JavaScript right on the hardware

#127

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…

Everybody thinks they know javascript, but on the contrary nobody actually knows it. It's a very twisted and powerful language. It has many quirks and many unknowns. Most of the time if one thinks s/he knows javascript, actually s/he knows a higher level abstraction library and DOM built on javascript like Jquery.

Some people do know javascript. Implementations differ, but are getting more standardized as time goes on. Without the DOM and browser environment APIs, it gets a lot simpler. Do you think fewer people actually know javascript than actually know C++?

Re: JavaScript right on the hardware

#128
post #71
post #54

Earlier quoted context omitted.

I don't have much problem with programming an embedded device in a high-level language, but why JS specifically? Why not Lua, which just as fast, and is better than javascript in many respects?

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…

> the three primary factors affecting the adoption of a programming language by developers are, in this order:

> 1. Libraries available

Not just programming languages. Microcontrollers too. You could get much better performance out of a bare AVR, but where are the libraries and modules? Whereas an Arduino comes with a library for anything that moves - of course most people are going to prefer it.

Re: JavaScript right on the hardware

#129
post #54

Earlier quoted context omitted.

I don't have much problem with programming an embedded device in a high-level language, but why JS specifically? Why not Lua, which just as fast, and is better than javascript in many respects?

Slightly off topic, but is it just me or has Lua gotten a lot of attention on HN in the past weekish? I haven't heard much of Lua before but recently it seems to have come up a lot more. And even more off topic (sorry), what makes Lua better/different than other scripting languages? EDIT: On jacobwcarlson suggestion, I Googled Lua vs Python, and found this Wiki, http://lua-users.org/wiki/LuaVersusPython Not a speed c…

I don't know where it is coming from as well.

But one area where Lua is gaining traction is because it is the only high level language that is integrated with Nginx.

Post reply on HN