Live data from Hacker News

DeviceScript – TypeScript for Tiny IoT Devices

github.com

131–140 of 160 posts

Re: DeviceScript – TypeScript for Tiny IoT Devices

#131
post #96
post #38

Earlier quoted context omitted.

Why the wait? Microsoft's MakeCode project already provides something similar, via compilation to C++, for quite some time now.

We're the same people who founded MakeCode. DeviceScript has a very different target audience (professional TypeScript developers vs students), is easier to port to different architectures, is more tied into VSCode, and is more compatible with JavaScript semantics (though slower). Also MakeCode compiles to ARM machine code in the browser, not C++, which is one of the things that make it hard to port.

I remember there was a MSR talk about compiling via C++, hence the reference.

Re: DeviceScript – TypeScript for Tiny IoT Devices

#132

My personal opinion is that good typescript to C transpiller would do a way better job, tons of microcontrollers supported out of the box. I would be also happy to use it for desktop. With some tricks it could even support references and additional numeric data types (u8, i8 ... ) without breaking any syntax

I think a language that just transpiled to the equivalent C would be pretty awesome. I know Google is building Carbon, but it is more focused on C++. They pitch it as Typescript to JavaScript, Scala to Java, Carbon to C++. Instead of Rust or Zig trying to replace C++ or Java, is seems better to just integrate with it without linking through some FFI. I'm working on some C code for some microcontroller since it was to…

I could be wrong, but doesn't vlang and nim do this?

Re: DeviceScript – TypeScript for Tiny IoT Devices

#133

My personal opinion is that good typescript to C transpiller would do a way better job, tons of microcontrollers supported out of the box. I would be also happy to use it for desktop. With some tricks it could even support references and additional numeric data types (u8, i8 ... ) without breaking any syntax

I'm not an expert, but wouldn't garbage collection be a difficult problem as well?

Re: DeviceScript – TypeScript for Tiny IoT Devices

#134

Earlier quoted context omitted.

I think a language that just transpiled to the equivalent C would be pretty awesome. I know Google is building Carbon, but it is more focused on C++. They pitch it as Typescript to JavaScript, Scala to Java, Carbon to C++. Instead of Rust or Zig trying to replace C++ or Java, is seems better to just integrate with it without linking through some FFI. I'm working on some C code for some microcontroller since it was to…

I could be wrong, but doesn't vlang and nim do this?

Has vlang managed to get past its controversies and actually deliver on its promises? Last I heard it was still promising too much, under delivering and not handling the feedback too well.

Re: DeviceScript – TypeScript for Tiny IoT Devices

#135

My personal opinion is that good typescript to C transpiller would do a way better job, tons of microcontrollers supported out of the box. I would be also happy to use it for desktop. With some tricks it could even support references and additional numeric data types (u8, i8 ... ) without breaking any syntax

Pure Typescript supporting all of the Ecmascript spec would have to output a lot of C to get the same results.

It obviously would have to be a limited subset, like devicescript is also "just" a subset of typescript.

I think the limitations for devicescript would probably also work for outputting reasonable amounts of C.

Re: DeviceScript – TypeScript for Tiny IoT Devices

#136

My personal opinion is that good typescript to C transpiller would do a way better job, tons of microcontrollers supported out of the box. I would be also happy to use it for desktop. With some tricks it could even support references and additional numeric data types (u8, i8 ... ) without breaking any syntax

I'm not an expert, but wouldn't garbage collection be a difficult problem as well?

It would have to include its own garbage collector, yes.

Re: DeviceScript – TypeScript for Tiny IoT Devices

#137
post #17

Is 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.

There are a number of reasons to do this. This sort of setup typically has the VM runtime flashed into the microprocessor's program space with the interpreted byte code stored in data space --- either internal or external. 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…

I’m not sure if you get the controllers part of embedded microcontrollers. They’re not for time-independent deep thoughts, they are for controlling devices and peripherals in real time.

1) you get shorter battery life for slower code. Also, everything is speed critical anyways. It sucks when I’m controlling my toy robot and it’s trying to drive into the floor while doMyStuff(); has its head stuck in float math.

2) external anything is added cost to everything; adding an SPI Flash for code to otherwise done board costs, I don’t know, $2 for the chip, $0.02 for capacitors and resistors, 2-3 days to redo the board, software… can I just make it a want item for v2.0?

3) why do I have to do it wireless? Can I just snatch a prototype from test batch, wire it to debugger and leave it on a desk? Do I really have to manage these keys, and why are you going to be signing it off for release if it’s not working?

Embedded devices are not like a Nintendo Switch, it’s like Switch Joy-Cons, or even buttons on Joy-Con sometimes. They are not like nail-top autonomous Pi calculation device. Admittedly, Nintendo update Joy-Con firmware sometimes, but very rarely, and they don’t make Switch playing kids wait for X button input to finish processing. The buttons are read, sent out, and received. It just makes no sense that adding drag to real-time computing this way would help a lot.

Re: DeviceScript – TypeScript for Tiny IoT Devices

#138

Earlier quoted context omitted.

I could be wrong, but doesn't vlang and nim do this?

Has vlang managed to get past its controversies and actually deliver on its promises? Last I heard it was still promising too much, under delivering and not handling the feedback too well.

I have never used it. I just remember reading on the README that is compiles to human readable C.

Re: DeviceScript – TypeScript for Tiny IoT Devices

#139
post #93

Sounds a bit similar to assemblyscript. I wonder if there's a connection between those projects. Assembly script targeting WASM on small devices might be useful.

We need to add a doc page about relationship with WASM... In short, WASM was not designed to be interpreted, and definitely not on small devices. The DeviceScript VM bytecode is designed to run directly from flash (read-only memory of which you have typically 10x more on an embedded system), with minimal overheads. Also WASM is not designed as a runtime for a dynamic language, eg., + operator would be for two i32 and…

Promised docs here: https://microsoft.github.io/devicescript/language/runtime#wh...

Re: DeviceScript – TypeScript for Tiny IoT Devices

#140

Earlier quoted context omitted.

Has vlang managed to get past its controversies and actually deliver on its promises? Last I heard it was still promising too much, under delivering and not handling the feedback too well.

I have never used it. I just remember reading on the README that is compiles to human readable C.

I that case it might be useful to check previous threads here since vlang has been quite controversial. Or check what they have implemented versus promised.
Post reply on HN