Live data from Hacker News

JavaScript right on the hardware

technical.io

251–260 of 320 posts

Re: JavaScript right on the hardware

#251

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.

Very, very different things. The BBB and the Raspberry Pi are designed to be relatively high-power (both computational, and power draw from DC) devices running a true multiuser OS. This thing is more akin to an Arduino Micro or a Teensy - a low-power controller that could run a very long time on a tiny battery, no OS to speak of, just a single loop of essentially real-time code. I just made a hardware clock for my PC…

I agree about the arduino and batteries, but this board is a bit different.

It uses external memory which takes more power. It uses javascript which could take much more power. And the wifi also might not be low power. So it's not clear yet how low power it is.

Re: JavaScript right on the hardware

#252

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?

just to answer you: I Like Javascript. I like my functions as first class citizens. I like my prototypes and my inheritance model. I like my callbacks and my closures. I like how I can move from client-side, to server-side, to my TV, all with the same language. I like how easy it is for beginners to produce something useful and for seasoned developers to produce something good. There are many other languages that sha…

Having written c# for many years JS is like a breath of fresh air simply because it is dynamic and you aren't confined to the inheritance model of c#

Re: JavaScript right on the hardware

#253

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.

C/C++ is always in one corner because it's the go-to language (heh) for code that needs to do direct hardware access and manipulation. That said, if I don't strictly have to run C/C++, I'd much rather run Haskell or Python. And you'd be surprised where you can run high-level languages like Python; one project I work on runs Python in the GRUB2 bootloader to test BIOS and hardware, giving Python full ring0 privileges,…

Well I have been trying to play around with LLVM on ARM Cortex-M4 micro controllers specifically the STM32F4 series of my controllers there is a github project that tries to use Clang.

Now if I had the time and experience I wanted to try and compile this library called py2llvm. The library that can compile static variables and python syntax into LLVM bitcode with C like performance. I think that is the best of both worlds.

Re: JavaScript right on the hardware

#254
post #116

Earlier quoted context omitted.

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

Absolutely. On AVRs, `new` and `malloc` work, but just barely. RAII/stack-only programming is basically a necessity. That is simply not possible with languages like Python or Javascript.

To be fair, the Espruino JavaScript interpreter manages this pretty well (in around 8kB of RAM). http://www.espruino.com

Re: JavaScript right on the hardware

#255
post #46

Earlier quoted context omitted.

As someone who has come around to Javascript after many years avoiding it, I think I can answer you: people like Javascript for a similar reason to why people like Python. As long as you stick to a strict set of conventions, Javascript is a very compact and manageable language, with a bit of extra flexibility to spice things up due to its prototypal nature. With Python, you don't have to worry about the conventions p…

Any chance you could point out a couple of good resources that cover the "strict set of conventions" you mention for Javascript? I've been dabbling in Javascript projects for a while now, and one of my biggest frustrations has been that I haven't been able to find any great resources that cover best-practice code design (above the level of style guides that cover mainly syntax issues). It would be great to have a cou…

I think most frameworks for JS are opinionated, I mean things like jQuery, Sencha, AngularJS, emberJS, or also various server side frameworks.

Once you specialize on using one of them, you'll probably adopt their conventions.

I myself haven't settled yet, too my own dismay. It's not easy.

Re: JavaScript right on the hardware

#256
post #42

I'm curious about performance on this, compared to something like the Arduino YUN, which is basically a OpenWRT MIPS system (which uses a Lua UI by default) and an Arduino tacked on the side: http://arduino.cc/en/Main/ArduinoYUN The CPU in particular seems quite underpowered assuming that they're clockspeed comparable, but I'm not familiar enough with the M-series ARM cores to give a proper opinion.

This is way better then Yun, IMO. Yun is an awkward design, I find very few reasons they had to put an 8-bit AVR and AR9 on one board. WTF. I really like this solution with a beefy LPC18xx and CC3000, it's totally cool by me.

Re: JavaScript right on the hardware

#258
post #234

Earlier quoted context omitted.

You seem to think these programmers are content with simply learning only what they need to know and calling it a day. As a self taught developer, I find it offensive that you think I would go through all the trouble of teaching myself how to code, and then rest on my laurels, like I wasn't inherently curious and thoughtful. Since learning Javascript front to back, I've developed a curiosity with strictly typed langu…

People like yourself are the exception, usually the majority follows what the parent post was stating. As someone that codes since 1986 with a CS degree, I am often dismayed what many "programmers" seem to know nowadays.

Programmer may have been an elite title at one time, but now it's just like saying gardner, chef, or scientist. You just have to work a little harder to figure out whether or not someone is a moron. There have always been morons and there always will be. I may be one of them!

Re: JavaScript right on the hardware

#259
post #136

Earlier quoted context omitted.

There still isn't any language specification, is there? JavaScript, TypeScript, and Dart have one.

But the one-page manual of coffeescript is far more useful to users than those looong specifications. No document about the syntax is better than the annotated source of the parser. And you can find specifications about all kinds of javascript runtimes elsewhere, they document the coffeescript runtime too.

Language specifications are important for interoperability. They are very useful for people who write tools like smart IDEs or linters. They are also interesting for people who want to create their own VM or compiler. There are various JavaScript and Java VMs. There are also various C and C++ compilers.

But there are also users who read them if they think that some particular behavior is puzzling. Then they check the spec to see if this stuff really is supposed to happen or if this is something which wasn't properly specified.

For example, there was a 50:50 split when it came to the behavior of SVG masking. As it turned out, that part of the spec was just confusingly written and the compliant behavior was actually really silly. The spec was changed and now every browser does the same intuitive thing.

Without this "central authority" there wouldn't have been a way to get this fixed.

Dart is another interesting example. They had a specification since the beginning and every part of the ecosystem follows it. This way, different teams (and even different companies) can create all kinds of tools which all have the same precise understanding of the language. Naturally, this also helps with identifying spec issues.

Without a specification, you have to reverse-engineer the behavior and you might end up being forced to replicate some really nasty crap. Some of JavaScript's warts were set in stone this way.

Re: JavaScript right on the hardware

#260
post #50

Earlier quoted context omitted.

It's extremely simple - basically everything is a hash. It has full lambda, not just crippled lambda like Python. It's very fast (I think it is the fastest scripting language except for Lua, and getting faster because of the browser wars). It usually doesn't require a lot of boilerplate code. What is not to like? The one thing I worry about is the limited range of integers.

Non-string values are not valid hash keys. Operations that should be type errors fail silently and return nonsense. The prototype system is less powerful than the OO system of basically every other scripting language. The language will never have continuations, so people who want real control flow are stuck using preprocessors to generate callback spaghetti. Encoding a particularly rigid mix of dynamic and lexical sc…

Sure if you prefer static typing then JS is not for you.

Continuations seem to be rare among other languages you could choose. Personally I have only seem them in LISP, what else is out there?

I would love to use LISP, but the libraries simply aren't there. Last time I tried Racket, there wasn't even a library for JSON.

Post reply on HN