Stories
Slash Boxes
Comments

SoylentNews is people

posted by janrinok on Friday September 06 2019, @05:06PM   Printer-friendly
from the its-a-start dept.

Arthur T Knackerbracket has found the following story:

Go — a modern programming language with roots at Google — is one of the new generation languages that would like to unseat C (and C++) for what we think of as traditional programming. It is only for PCs, though, right? Not so fast! TinyGo provides a compiler that — in their words — is for small places. How small? They can target code for the Arduino Uno or the BBC micro:bit. It can also produce code for x86 or ARM Linux (both 32- and 64-bit) as well as WebAssembly. They claim that a recent project to add ESP8266 and EPS32 support to LLVM will eventually enable TinyGo to target those platforms, too.

As you would expect, there are some subtle differences between TinyGo and the full-blown version. The compiler handles the entire program at once which is slower but offers more for optimization. Certain optimizations for interface methods are not used in TinyGo, and global variable handling changes to accommodate moving data from flash to RAM efficiently. TinyGo passes parameters in registers.

Other changes are more profound. For example, there’s no garbage collection yet, so you are urged to not perform heap allocations after initialization. There are also a few other major features not supported. Concurrency in the form of goroutines and channels, cgo, reflection, and three index slices won’t work. Maps are available, but only with certain key types. Because of the missing pieces, many of the packages in the standard library won’t build.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 0) by Anonymous Coward on Friday September 06 2019, @10:44PM (1 child)

    by Anonymous Coward on Friday September 06 2019, @10:44PM (#890741)

    Basically C... without undefined behavior...

  • (Score: 0) by Anonymous Coward on Friday September 06 2019, @11:43PM

    by Anonymous Coward on Friday September 06 2019, @11:43PM (#890765)

    Just about all the undefined behavior in C is avoided by not depending on behavior that is undefined. This is not as hard as it sounds, especially if you use the C99 standard. It does mean the language is unsuitable for script kiddies and must be written with care. I wouldn't write a desktop application in C, for example, but for OS level or small embedded system code, it hits the sweet spot.