15 votes

Microsoft launches Devicescript, a subset of typescript that compiles to bytecode. What do you think?

6 comments

  1. [3]
    skybrian
    Link
    Here's a limitation I noticed: although it runs on devices with WiFi, it doesn't let you make web requests easily yet, which means you can't easily trigger web hooks. I've only helped with one...

    Here's a limitation I noticed: although it runs on devices with WiFi, it doesn't let you make web requests easily yet, which means you can't easily trigger web hooks.

    I've only helped with one WiFi-enabled device (using Arduino and a Raspberry Pi Pico) and triggering web hooks was pretty much all it used WiFi for.

    But I have no objection to scripting languages in principle and it will be interesting to see how it evolves. I somewhat prefer TypeScript to Python.

    6 votes
    1. [2]
      buzziebee
      Link Parent
      I skimmed through the docs before posting and it looks like they implement the native fetch for any http requests....

      I skimmed through the docs before posting and it looks like they implement the native fetch for any http requests.

      https://microsoft.github.io/devicescript/getting-started/samples/github-build-status#using-fetch

      It was one of the first things I thought of so I searched it out. They also have TCP and TLS support, I couldn't see anything about UDP though which might be desired.

      https://microsoft.github.io/devicescript/developer/net#tcptls-sockets

      I haven't actually run devicescript though yet so perhaps it's more complicated in reality.

      3 votes
      1. skybrian
        Link Parent
        I'm out of date. Looks like fetch just got added last week.

        I'm out of date. Looks like fetch just got added last week.

        2 votes
  2. [2]
    Akir
    Link
    It's going to be tough to displace my love affair for Lua in the tiny embedded interpreted language niche. I think that there are bound to be some issues taking a multi-headed beast like...

    It's going to be tough to displace my love affair for Lua in the tiny embedded interpreted language niche.

    I think that there are bound to be some issues taking a multi-headed beast like Javascript and trying to shrink it down to microcontroller size. The devil is going to be in the details of how it's implemented. It's got a lot of potential to shake things up, that's for sure. Anything that makes programming in the embedded space more accessible is a good thing in my book.

    4 votes
    1. buzziebee
      Link Parent
      I did a fair bit of Lua on some embedded hardware at my old job. It's incredibly basic but that makes it quite fun to program with. Pretty much everything being a dictionary is a lot of fun! It...

      I did a fair bit of Lua on some embedded hardware at my old job. It's incredibly basic but that makes it quite fun to program with. Pretty much everything being a dictionary is a lot of fun!

      It looks like it could be a good competitor of micropython. Having good typings and a great package system could be a winner for that kind of application. I couldn't find much on their C bindings stuff though which might be required for a lot of libs and drivers. Maybe that will come later. Would be nice to have the 'glue' of Typescript/Devicescript with the performance packages running in C like python has.

      3 votes
  3. buzziebee
    Link
    I just saw this article and checked out the docs: https://microsoft.github.io/devicescript/ As a primarily typescript dev who likes to play around with embedded stuff this actually looks quite...

    Any application that can be written in JavaScript, will eventually be written in JavaScript

    I just saw this article and checked out the docs: https://microsoft.github.io/devicescript/

    As a primarily typescript dev who likes to play around with embedded stuff this actually looks quite cool. They have spent a lot of time building out useful ways to interact with devices and it looks super easy to set things up as an IOT device using language features you already use in the web.

    It runs on a custom VM (10kb) and will inevitably be slower than C or rust code would be, but for little things you want to hack together it could be cool. Reminds me a lot of espruino which was very fun to hack with.

    I've been thinking about creating a pebble successor (just need the time) and they had their apps built with js. It could be a really neat plugin to run compiled Devicescript from users on embedded OS' which are written in rust/C.

    What do you all think?

    Will it be something you try out? What would you build with it?

    Or is it just more attempts to use JavaScript where it really doesn't belong?

    3 votes