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: 2) by fadrian on Friday September 06 2019, @05:41PM (14 children)

    by fadrian (3194) on Friday September 06 2019, @05:41PM (#890625) Homepage

    It doesn't work, yet; it's still someone's research project at Google; it will be canceled six months after it's officially released.

    Tell me again, why should I care?

    --
    That is all.
    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 4, Insightful) by RamiK on Friday September 06 2019, @06:14PM (11 children)

    by RamiK (1813) on Friday September 06 2019, @06:14PM (#890634)

    It doesn't work, yet; it's still someone's research project at Google; it will be canceled six months after it's officially released.

    Back in 2009 when Go came out, the GC was treated like an implementation detail to hack together since it was only a matter of time before hardware assist comes along. Around 2014 they realized they needed to do a little more so they really started putting some work into it that lasted until around 2018 ( https://blog.golang.org/ismmkeynote [golang.org] ).

    However, this isn't 2009 or 2014 anymore. We have at least two separate tiny embedded chips with garbage collection built into the hardware ( https://www.cnx-software.com/2019/08/15/the-visible-lisp-computer-runs-on-adafruit-itsybitsy-m0-board/ [cnx-software.com] https://www.cnx-software.com/2019/07/05/javaino-joc-reference-board-module-java-embedded-systems/ [cnx-software.com] ) and a whole range of Micro-controllers running MicroPython that prove that if you just write the compiler, someone will port it or maybe even put together some hardware for it.

    So, hardly some cart before the horse research project when the hardware is already there just waiting.

    --
    compiling...
    • (Score: 1, Insightful) by Anonymous Coward on Friday September 06 2019, @06:25PM (9 children)

      by Anonymous Coward on Friday September 06 2019, @06:25PM (#890640)

      I think you overestimate how much a small embedded system can do to support high level language conveniences.

      • (Score: 2) by DannyB on Friday September 06 2019, @06:33PM (8 children)

        by DannyB (5839) Subscriber Badge on Friday September 06 2019, @06:33PM (#890645) Journal

        I think you underestimate how much research and work will be done to support more productive developer time.

        "small" "embedded" systems today are bigger than mainframe cpus were in the early 1970's.

        Once upon a time, when machines cost millions of dollars, and developers cost $20 K / year (in, say 1970s dollars), it was economical to optimize for every byte and cpu cycle. Now machines are dirt cheap and developers cost serious money. Do the math.

        Also errors caused by using too low level a language cost real money. Also security is "a thing" now. We want to reason about software in a higher level way.

        --
        To transfer files: right-click on file, pick Copy. Unplug mouse, plug mouse into other computer. Right-click, paste.
        • (Score: 1, Insightful) by Anonymous Coward on Friday September 06 2019, @07:13PM (7 children)

          by Anonymous Coward on Friday September 06 2019, @07:13PM (#890656)

          You clearly don't understand what "small embedded system" means.
          I'm talking about microcontrollers that cost a dollar or two, not a stripped down PC target.
          Are a scripter by chance, the kind of programmer who never *really* knows what his machine is doing? That's not embedded programming.

          • (Score: 1, Insightful) by Anonymous Coward on Friday September 06 2019, @07:36PM (2 children)

            by Anonymous Coward on Friday September 06 2019, @07:36PM (#890669)

            Are a scripter by chance, the kind of programmer who never *really* knows what his machine is doing? That's not embedded programming.

            Well, Go is compiled, like C. The problem is that these languages are just too large and heavy for low power chips. There is a reason why a low power chip will run off of one CR2032 for 10 years and your "smart watch" runs for literally few hours before it drains a much larger battery. We are talking low micro-amps and nano-amps currents here.

            https://www.microchip.com/design-centers/lowpower [microchip.com]

            But people think that Raspberry Pi is "embedded". Well, some last company called a regular Xeon with 16GB RAM inside a robot "embedded" ;) I guess in that context you can run whatever the hell you want.

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

              by Anonymous Coward on Friday September 06 2019, @07:53PM (#890677)
              The article is not about a Xeon or something that drives Waymo cars. It is about weak and slow R-Pis that are thermally challenged on top of their other limitations. The best compiled language for them is C, a well known low level language that lets you control every allocation. People write very tight and fast real time code in C for R-Pis, like Pi-Star or piaware. GC makes your program nondeterministic - that is fine if you are writing a form filling application for a regular desktop PC. But Pis are often used for automation and signal processing, for small services that run endlessly. RAM is limited, my Zero W in a Jumbospot has only 512 MB. Maybe you can run a Go program on it, maybe you need a R-Pi 4 with a water cooler, maybe you can run Linux on a Zilog Z80 - but those are not typical scenarios.
            • (Score: 1, Interesting) by Anonymous Coward on Friday September 06 2019, @08:49PM

              by Anonymous Coward on Friday September 06 2019, @08:49PM (#890704)

              C is not too large and heavy. It is extremely close to the hardware. How tiny can it be? Tiny enough to run on 8051 CPUs. That's pretty small!

              In embedded world with C there is usually only a memory block copy and a memory block zeroing before main() function runs your application. Well, in addition to any hardware configuration, (setting up clocks and memory) which would have to be done regardless of the programming language. There may also be a table of functions (constructors) that are called prior to main() if you are using C++, but that's it. If you compile a simple program and it seems larger than it should be, check your C start-up and C run-time library - you might be compiling the deluxe do-everything versions instead of the embedded versions.

          • (Score: 3, Interesting) by RamiK on Friday September 06 2019, @08:14PM (3 children)

            by RamiK (1813) on Friday September 06 2019, @08:14PM (#890689)

            Are a scripter by chance, the kind of programmer who never *really* knows what his machine is doing? That's not embedded programming.

            Don't delude yourself you have any clue what the machine is doing just because you're writing x86/ARM/POWER assembly. Modern machines are PDP11 emulators that hide the cache levels with branch predictors and decoders that turn your "low-level assembly" into something so completely different you might as well be writing bash scripts.

            This is what silicon really looks like when you shave off the conveniences: http://www.ti.com/lit/ds/symlink/tms320c6474.pdf [ti.com]

            --
            compiling...
            • (Score: 1, Insightful) by Anonymous Coward on Friday September 06 2019, @11:18PM

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

              Small embedded systems come with either no OS or a very stripped down one that mostly is a task scheduler.
              When it comes to understanding the system, I meant embedded programmers know what the software system is doing.
              Also you have a closer understanding of the hardware and control of timing issues. Very small systems definitely have direct control over certain CPU states.
              All this is necessary for realtime performance, low power consumption, or ability to run on ultra cheap hardware.

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

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

              The fact that you bring up x86/ARM/POWER CPUs in reference to **small embedded systems** just reinforces that you are totally ignorant about the field. You just don't know what it is.

              • (Score: 0) by Anonymous Coward on Saturday September 07 2019, @12:18AM

                by Anonymous Coward on Saturday September 07 2019, @12:18AM (#890777)

                "small" "embedded" systems today are bigger than mainframe cpus were in the early 1970's.

                The fact that you bring up x86/ARM/POWER CPUs in reference to **small embedded systems** just reinforces that you are totally ignorant about the field. You just don't know what it is.

                There some small variants:

                x86: https://en.wikipedia.org/wiki/Vortex86 [wikipedia.org]

                ARM: https://en.wikipedia.org/wiki/ARM_Cortex-M#Cortex-M3 [wikipedia.org]

                POWER: https://en.wikipedia.org/wiki/RAD750 [wikipedia.org]

                Are you talking about 8bit like PIC and z80s here? Cause MicroPython targets some of those too so TinyGo and uLisp can do as much too. I mean, why not?

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

      by Anonymous Coward on Friday September 06 2019, @08:33PM (#890698)

      No, these boards do not have garbage collection "built into the hardware". One is based on one of Atmel's (now Microchip) Cortex M0+ CPU. The Java based board is based on ??? has sticker hiding the actual part number (boo!) and I'm too lazy to find it out.

  • (Score: 1, Insightful) by Anonymous Coward on Friday September 06 2019, @06:44PM (1 child)

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

    Because Google is trying to ram Go down the throat of every system developer, since the more abstraction layers they bury us in, the less of us filthy commoners will understand how our computers actually work, making sure it is much harder to remove whatever baked-in malware or spyware big tech plans for us long-term. Plus, C and C++ are perhaps the only major languages not subject to the dictates and whims of a single (or only!) major implementation, and as such, are unacceptably difficult to manipulate.

    Can't have us able to fight back, after all!

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

      by Anonymous Coward on Friday September 06 2019, @07:40PM (#890672)

      Go is the future. You hate change because you are toxic.