9 ms·
Toit – A Language Designed for Microcontrollers
- lin83 4y agoIs Jaguar an interpreter and Toit the scripting language? How does it compare to MicroPython? Can I link in C drivers?
- floitsch 4y agoJaguar is the tooling to enable rapid development. It consists of two parts: one that runs on the ESP32 and another one that runs on your computer. Whenever a new program is ready, it gets pushed (over WiFi) to the device. The whole process only updates the actual program (not the whole OS), thus making the development cycle really fast. Compared to MicroPython, Toit is significantly faster. In my (obviously biased) opinion, it's also more robust. You can't link C drivers directly without modifying the Toit code base, but there is a bridge to talk between C and Toit code. Generally, we prefer to reimplement the drivers in Toit. However, for some bigger ones it clearly makes sense to keep the C version.
- ilvez 4y agoRandom fact Wednesday: Toit is food in Estonian.
- Zababa 4y agoToit is roof in French.
- speed_spread 4y agoLe toit! Le toit est en feuuuuu!
- oneplane 4y agoAnother random fact: Toit is followed up with noice in Brooklyn 99
- bmacho 4y agohttps://en.wiktionary.org/wiki/toit https://en.wiktionary.org/wiki/toit
- hoosieree 4y agoI like the syntax. It looks like a combination of Ruby and Python with a goal of being more terse than either.
- causi 4y agoI like it, but I am never going to be able to read the name without thinking of Goldmember saying "toit like a tiger".
- laputan_machine 4y agoI instinctively read the title of this thread in Goldmember's voice
- causi 4y ago"Toit, a languaj de-shined for microcontrolersh, yaysh"
- deleted 4y ago[deleted]
- Smoosh 4y agoI thought "get toit" or "get a round toit".
- sk0g 4y agoThe syntax looks pretty fun to work with! Nice balance of terseness and readability.
- hammyhavoc 4y agoCan't wait to hear all the mangled pronunciations of this.
- ghkbrew 4y agoI don't see an etymology of the name on the site, so I'll just assume they misspelled "tuit" [0] [0] https://en.m.wiktionary.org/wiki/round_tuit https://en.m.wiktionary.org/wiki/round_tuit
- aaa_aaa 4y agoAFAIK this name was intentionally given with Austin Powers reference.
- ErikCorry 4y agoTrue, but you can think of it as a Brooklyn Nine-Nine reference if you prefer.
- stjohnswarts 4y agotoo late for me, it will forever be "toyt"
- one-more-minute 4y agoMust be because I learned some French as a kid, but I can't help reading the "oi" as a "wa" sound in this context. Probably not what the authors were going for.
- vukgr 4y agotwat?
- spread_love 4y ago
- titzer 4y agoIt's worth noting that Toit is developed by the team that developed V8, so it's got a really solid implementation by very knowledgeable people.
- frankus 4y agoI wonder what the memory model is, and if it's suitable for low-level and real-time code.
- Existenceblinks 4y agoWould be cool if it replaces javascript. It seems they have knowledge of almost all things needed.
- titzer 4y agoThey designed Dart before this.
- Existenceblinks 4y agoWhat I learn from coding for a decade is mistake never makes perfect!
- titzer 4y agoLanguage design is hard. It's impossible to please everyone. What Dart has taught me is that JavaScript is not going to be displaced on the web anytime soon. Dart seems to have found its stride with Flutter, a cross-platform UI framework.
- skybrian 4y agoSupported hardware is very limited [1]. I guess it could be good if you know you want to use an ESP32. [1] https://toit.io/product/supported-hardware https://toit.io/product/supported-hardware
- lawrenceduk 4y agoI looked at this the other day! Sadly no way to configure WiFi other than at the point of flashing the device which rules it out for a lot of use cases.
- ErikCorry 4y agoStay tuned.
- AYoung010 4y agoCall me old-fashioned, but I personally do not like the idea of using a garbage-collected language for embedded development in general, and it's just flat out non feasible to use for anything which is timing-sensitive...
- floitsch 4y agoIn big parts that's true, but there are some good arguments in favor of a GC for these small devices: - the GC is a sliding compacting GC. As such there is no fragmentation for heap-allocated memory. - the memory on these devices is tiny. The GC thus doesn't take long time. - the ESP32 has really good peripherals, making timing sensitive operations very rare. In most cases there is a hardware module that does the job for you. The timing requirements then usually become significant less important.
- stjohnswarts 4y agodepends on how the system works. What are the timing requirements? How powerful is the CPU? How much memory do you have? How often will the system be reset? Embedded isn't just 8/16 bit CPUs with < 128k of memory these days.
- turbinerneiter 4y agoWhat do you think is the ratio between projects that need precise timing and projects that publish some sensor data every 60 seconds? I think you can easily do 90% of iot projects with this. Which means you have more time for the 10% of projects that are actually hard.
- cozzyd 4y agoIf you're using LoRaWAN to publish and don't want to blow up your power budget, you need to get somewhat good timing.
- turbinerneiter 4y agoSub-millisecond?
- floitsch 4y agoFor those interested in a comparison to MicroPython: I recently wrote a Toit version of the MakePython ESP32 Dev Kit lessons. Here is the Toit version of it: https://docs.google.com/document/d/1K-TYea7jbYfj2ecMUmr0T0zd4JDpk5lo0mJNOLPUrhc/edit?usp=sharing https://docs.google.com/document/d/1K-TYea7jbYfj2ecMUmr0T0zd... And here the MicroPython: https://www.makerfabs.com/desfile/files/Get-Started-MicroPython-with-ESP32-V2.2.pdf https://www.makerfabs.com/desfile/files/Get-Started-MicroPyt...
- hoosieree 4y agoThanks for sharing. Complex examples like these are great to highlight syntax which simpler examples never mention. For example (heart rate sensor excerpt): remembered_ = List width/2: initial_value half_height := height / 2 ... min_value := remembered_.reduce: | a b | min a b These lines (with seemingly context-sensitive meanings for the / and : characters) feel less obvious to me than the examples on the home page.
- floitsch 4y agoThe `:` are actually doing the same thing, introducing a block (think of it like a limited function). The `/` are also the same (division), but it's true that we also use `/` to introduce types. For example `x/int`. I think Toit is relatively easy to learn, but there are definitely a few things that need explaining in the beginning.
- mananaysiempre 4y agoExcuse my idle curiosity, but... slash for type ascription? How did that happen? The only precedent I can think of is Prolog’s arity annotations (and jq’s, but I suspect a direct influence there). Does this come from some chunk of programming-language lore I’m unaware of?
- krallja 4y agoIt’s also used in Elixir and Erlang for arity, but now that I think about it, it’s probably descended directly from Prolog.
- extinctpotato 4y agoIt feels very Ruby-like. In fact, it makes me wonder why not reuse Ruby's syntax if you're making a thing like that.
- ricardobeat 4y agoThat idea is taken. Twice. https://mruby.org/ https://mruby.org/ https://microruby.com/ https://microruby.com/
- ErikCorry 4y agoToit and Ruby are both inspired by Smalltalk, and there are certainly similarities in the syntax but we felt that starting 20 years later we could do a lot better than Ruby syntax. In particular, Python basically won the significant-indentation argument. Since all programs are formatted with correct indentation the punctuation is redundant clutter. So for a new language it just feels right to go with indentation instead of curlies. We also wanted to be free to add type annotations and other enhancements, so it was never going to be compatible with Ruby anyway. And we didn't want to raise expectations of Ruby-compatibility that would immediately be dashed.
- Jistern 4y agoAs long as Toit is licensed under the GNU Lesser General Public License v2.1, I am unlikely to consider using it. By contrast, MicroPython is licensed under the MIT License (MIT). As others have noted, Toit seems like a bad name. I suppose non-French speakers will tend to inadvertently mispronounce Toit. Getting traction is hard. In my opinion, having a restrictive license and a bad name make it less likely Toit will gain traction. Finally, Toit's licensing reminds me of Mongoose OS https://github.com/cesanta/mongoose-os#mongoose-os---an-iot-firmware-development-framework https://github.com/cesanta/mongoose-os#mongoose-os---an-iot-....
- croes 4y agoWhat's the problem with the LGPL?
- Jistern 4y agoThe GPL is for when you have an ideological agenda, the MIT is for when you don't. MIT says "do whatever you like with this but include the license" in less words than the GPL's preamble. GPL says people can use it, but can't without providing all the source code for no more than the cost of media (though I'd have to call a lawyer to be sure that's all it says these days because the damn thing is long and complicated) but it forces users to conform to someone's idea of fairness. Basically if the thought of your code ever ending up in something that someone might somehow make money from, like maybe in an iOS app, is somehow icky - then GPL is for you! If you just want to put it out there and code, not politics, is your thing - go MIT. Source... https://www.reddit.com/r/roguelikedev/comments/4g738z/comment/d2f8iwy/?utm_source=reddit&utm_medium=web2x&context=3 https://www.reddit.com/r/roguelikedev/comments/4g738z/commen...
- croes 4y agoIf you just want to use the compiler and VM the license doesn't effect you. You can write a closed source program in any GPL language using any GPL compiler.
- 4y ago
- skibz 4y agoI love the look of this language's syntax. I'd be happy to use it outside of embedded programming, too.
- floitsch 4y agoWe use it for some of our tools, so it's possible (and works nicely). Our LSP server was initially written in Toit: https://github.com/toitlang/toit/tree/master/tools/lsp/server https://github.com/toitlang/toit/tree/master/tools/lsp/serve... (To be fair, it uses the compiler underneath for analyzing the sources). Main restriction is, that we haven't finished the Windows implementation yet. Specifically networking and spawning processes only works on Linux/macOS so far. (The main reason we ported the LSP server to Go). The `host` package (https://pkg.toit.io/package/github.com%2Ftoitlang%2Fpkg-host@v1.4.1 https://pkg.toit.io/package/github.com%2Ftoitlang%2Fpkg-host...) provides some functionality for running things on the desktop.