Live data from Hacker News

JavaScript right on the hardware

technical.io

61–70 of 320 posts

Re: JavaScript right on the hardware

#61

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…

Correction - everyone thinks that they know Javascript. It's a more twisted language than it appears.

Re: JavaScript right on the hardware

#62

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?

I'd think Lua would have made a lot more sense.

Re: JavaScript right on the hardware

#64
post #57
post #24

Earlier quoted context omitted.

You prefer C over JavaScript? Header files? Pointer arithmetic hell? Precompiler Macros? Manual Memory Management? Seriously? To each their own, though.

On an embedded microcontroller, pointers and manual memory management tend to be less of an issue, as you're doing most of the stuff on the stack. I don't think I've ever had a reason to call malloc in an embedded C application before. If you were doing networking, however, it would probably be much more complicated. In that case, Javascript might be useful. But on the other hand, there are high-level languages that…

Which ones, though?

Re: JavaScript right on the hardware

#65
post #19

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?

Of all the great languages out there... we had to choose Javascript. It's a shame, would love to see more Smalltalk posts.

If Smalltalk ran on every.single.browser.ever, you would.

Re: JavaScript right on the hardware

#66
post #50
post #30

Earlier quoted context omitted.

Why? I really would like to understand, because I see JS as a necessary evil, and would rather use something else if given the option.

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.

I personally don't like that everything's a hash. It's nifty, and it means you don't really need objects, but I kinda like objects, even if I don't use them frequently in Python.

Your preference makes sense, it's just not the same one I have. More on topic for this thread, I'm still not convinced that it's a good thing for an embedded system.

Re: JavaScript right on the hardware

#68
post #60
post #30

Earlier quoted context omitted.

Why? I really would like to understand, because I see JS as a necessary evil, and would rather use something else if given the option.

@eob - same problem, couldn't reply directly to you. My main reason for liking Python isn't that it's compact and manageable (unless by compact, you mean the code one writes), but because I like the elegance of the language. You're saying you have to stick to strict conventions for JavaScript to be any good? That would imply that it isn't any good to me. I use it, frequently, I just prefer not using it.

I think JS is more elegant than Python - just different tastes, I suppose. I find the crippled lambda unacceptable, and I don't like things like len() as a standalone function (in Python).

Re: JavaScript right on the hardware

#69
post #53
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…

Not even for scripting them?

I would rather use Python for scripting.

Re: JavaScript right on the hardware

#70
post #57
post #24

Earlier quoted context omitted.

You prefer C over JavaScript? Header files? Pointer arithmetic hell? Precompiler Macros? Manual Memory Management? Seriously? To each their own, though.

On an embedded microcontroller, pointers and manual memory management tend to be less of an issue, as you're doing most of the stuff on the stack. I don't think I've ever had a reason to call malloc in an embedded C application before. If you were doing networking, however, it would probably be much more complicated. In that case, Javascript might be useful. But on the other hand, there are high-level languages that…

Generally, embedded applications know how much memory is needed at start-up based on the specification. So global memory is statically allocated.
Post reply on HN