Hacker News new | ask | show | jobs
by suprfnk 1111 days ago
Easy: because TypeScript or Python are way easier to learn than C. Learning C is a long, arduous, uphill battle against arcane error messages and undefined behaviour.

Unless you have a background in C/C++ already, most people can probably get up and running with something like this way, way faster.

2 comments

Good luck understanding things like `if(!!!c) { ... }` or why a line-break after a return statement matters in JavaScript/TypeScipt ;) JS has its own footguns and legacy baggage.
I've never seen `!!!` in JavaScript, and I do a lot of it. Care to share?
Shouldn't have made an example in the if-statement as it is mostly useless there. But triple ! is very common to negate-and-convert a possibly falsy statement (undefined, null, false/true):

const x: boolean | undefined | null = getValue(); const not_x: boolean = !!!y

I added TS type annotation for clarity, although could be inferred if `getValue` is typed accordingly.

I've seen `!!` and I've seen `!`, but what would `!!!` get you here that the other two don't?
negation plus cast to boolean. See this for more info: https://stackoverflow.com/questions/21154510/the-use-of-the-...
And line breaks after return statement? Is that true? Haven't stumbled on that one. So this is probably misinformation.
No, that one is true. JS automatic semicolon insertion is dumb.

   return
     <p>
       A JSX paragraph
     </p>
is a common mistake from novices; it'll return void/undefined.

In TypeScript, at least, you get yelled at for this.

How do you get that TypeScript or Python environment on the chip of your interest at the first place? How do you expose hardware interfaces without knowledge of C?
> How do you get that TypeScript or Python environment on the chip of your interest at the first place?

By having somebody else do it. Abstraction is a wonderful thing.

That's just kicking the can down the road. What if you are working on device which is under NDA? What if it is some exotic MCU which nobody else uses?
Then you probably shouldn’t use this. It’s not for you, that’s cool, move on and use whatever you’re currently using.
I am just showing you that DeviceScript/MicroPython/LUA/any other scripting language will expect from the user to know lot of C in order to be able to use its board unless they want to just run it without any input/output of data. But users want to use the scripting language because they don't know C. The whole flow is Catch-22.
I might have agreed 10 to 15 years ago when arduino was brand new and almost everything was custom.

These days... eh - pretty hard disagree with everything you've said.

Do some folks still need to know the ins & outs of the device? Sure. Will this work on every device? Nope.

Does that matter for the success of this project? Not a fucking bit.

Honestly - this looks a lot like Electron in my opinion: It gives companies a very cheap entry point into a whole realm of tooling that was previously out of bounds.

They can do it without having to hire new folks, they can prototype and run with it as far as they'd like, and then 3 years in, once the product is real and they know they have a market - they can turn around and pay someone to optimize the embedded devices for cost/power/performance/other.

The flow isn't catch-22 AT ALL. The flow is: I'm trying to do a thing that's only marginally related to the embedded device, and it's nifty that I can do that with low entry costs (both financial and knowledge).

---

By the time you are under NDA for a new device... you are established enough to be making your own decisions around tooling (basically - you are part of phase 2: optimize).