Is really hard for me to understand how running an VM on a resource constrained device has any benefit. There is a reason why those devices run using very lightweight "OS"s like FreeRTOS and Embedded C. Why the constant obsession to apply a technology designed for a specific purpose everywhere else, even when it doesn't make sense?
DeviceScript – TypeScript for Tiny IoT Devices
41–50 of 160 posts
Re: DeviceScript – TypeScript for Tiny IoT Devices
#42I really want to be able to compile typescript to not javascript. Ideally to native but if it’s bytecode or whatever that’s fine I don’t care. It’s a nightmare trying to deal with bundling and compiling and targets and different import schemes ugh. I wish I could compile my programs it compiles all the stuff in node modules and gives me some working code. Desperate to get away from nodejs I tried deno and bun …. neit…
So you want structural typing, but for native? Funny, the fact that typescript is "only" structurally typed is one of my main pain points with the language. (Of course it's tons better than vanilla JS)
Re: DeviceScript – TypeScript for Tiny IoT Devices
#43Is really hard for me to understand how running an VM on a resource constrained device has any benefit. There is a reason why those devices run using very lightweight "OS"s like FreeRTOS and Embedded C. Why the constant obsession to apply a technology designed for a specific purpose everywhere else, even when it doesn't make sense?
Same problem for MicroPython. Same problem for LUA, same problem for any scripting language running on constrained MCU.
Re: DeviceScript – TypeScript for Tiny IoT Devices
#44Is really hard for me to understand how running an VM on a resource constrained device has any benefit. There is a reason why those devices run using very lightweight "OS"s like FreeRTOS and Embedded C. Why the constant obsession to apply a technology designed for a specific purpose everywhere else, even when it doesn't make sense?
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.
Re: DeviceScript – TypeScript for Tiny IoT Devices
#45Earlier quoted context omitted.
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.
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?
By having somebody else do it. Abstraction is a wonderful thing.
Re: DeviceScript – TypeScript for Tiny IoT Devices
#46Earlier quoted context omitted.
So you want structural typing, but for native? Funny, the fact that typescript is "only" structurally typed is one of my main pain points with the language. (Of course it's tons better than vanilla JS)
What exactly do you miss? JS has built-in reflection, eg `typeof instance`, `instance.constructor.name`. Even multiple dispatch can be hacked together if you really need it, eg there is a library @arrows/multimethod.
class Dog { woof(){} }
class Cat { meow(){} }
function f(a: Dog|Cat) {
if (a instanceof Dog) {
a.woof()
} else {
a.meow()
}
}
let dogish = {woof: ()=>{}}
f(dogish)
This compiles because dogish is structurally a dog, the type system allows instanceof to narrow the type but "dogish instanceof Dog" is actually false, so at runtime this will crash after trying to call meow on dogish.Re: DeviceScript – TypeScript for Tiny IoT Devices
#47Earlier quoted context omitted.
Making it easy for hobbyists who already know that technology to have access. Micropython has been successful, and this is an alternative to that.
The github project indicates "DeviceScript brings a professional TypeScript developer experience to low-resource microcontroller-based devices." If you tell me is a toy, and somebody's pet project: fine. Is all about having fun. But then don't mention "professional" in the project description.
Instead of ctrl+f for "professional" I suggest re-reading it
>professional TypeScript developer experience
It is about experience of sane programming environment, right?
Re: DeviceScript – TypeScript for Tiny IoT Devices
#48Is the only reason for this to make it possible for web developers or people who know TypeScript to write code for IoT Devices? To fill the lack of experienced low level programmers? Because as language alone, I don't see a reason why I should I ever use this if I am not familiar with TypeScript already.
1) It is obviously not as fast as native but it is fast enough for a lot of applications. In embedded work, you don't get extra credit for being faster than necessary. Speed critical functions like communications are mostly handled at native speed by the VM.
2) Code size. Interpreted byte code (minus the VM) can be smaller and less redundant than native. And by adding cheap external storage, code can easily expand beyond the native program space of the micro.
3) Easy remote updates. Byte code can be received and stored without making changes to the micro's program code (no re-flashing required). It's possible to fix bugs and make changes or even completely repurpose the hardware from afar.
Re: DeviceScript – TypeScript for Tiny IoT Devices
#49Earlier quoted context omitted.
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.
Re: DeviceScript – TypeScript for Tiny IoT Devices
#50I really want to be able to compile typescript to not javascript. Ideally to native but if it’s bytecode or whatever that’s fine I don’t care. It’s a nightmare trying to deal with bundling and compiling and targets and different import schemes ugh. I wish I could compile my programs it compiles all the stuff in node modules and gives me some working code. Desperate to get away from nodejs I tried deno and bun …. neit…