Thursday, May 20, 2021

The golang tutorials

 I started learning Google's computer language "go" (also called golang, likely due to how easy it is to search for "go" in Google) about three years ago. I run Linux, so I downloaded "go" and started the tutorials. I think i got pretty far into it because i wrote a couple of the benchmarks i've written in other languages: c, fortran, perl, java, guile (scheme), php. These are the matrix multiply and the prime number sieve. It took a while, but i found the "go" sources on my system. They even work.

However, i had upgraded my Linux operating system to Linux Mint 19 (Mint is derived from Ubuntu, which is derived from Debian). I needed "go" again, so i installed it from the repository. Really easy. I got go version 1.10. The current version is 1.16.

I started the tutorials again, thinking i'd breeze through them, just as a refresher. However, bits from the tutorial stopped working pretty quickly. I did a bunch of Google searches. Frankly, it was frustrating. Eventually, concentrating on this one problem all day, i stumbled across something that suggested that the command "go mod tidy" was introduced in go version 1.14. I told the Linux package manager to remove go, downloaded the version 1.16 tarball and installed it.

That's what i get for trying to learn a new fast changing language. Hopefully, i'll use it often enough that i won't have to go through the tutorial again. At least my benchmarks still work.


1 comment:

Stephen said...

PHP, a much older language (but not old like Fortran), has recently released more than one new beta branch.

Mint 19 comes with PHP version 7.2.24 Released: 24 Oct 2019 and is listed in "Unsupported Historical Releases" now. Mint 19 itself has passed end of life. Lots of PHP releases in 7.2, 7.3, 7.4 and 8 (up to 8.0.9) are listed in "Unsupported Historical Releases". Current releases marked Stable include PHP 8.0.10, 7.4.22, and 7.3.30.

Red Hat RHEL6 PHP is 5.6.23 Released: 23 Jun 2016 appears to be a branch - PHP 5. There's a note:
Support for PHP 5 has been discontinued since 10 Jan 2019.Please consider upgrading to 8.
Apparently, PHP 5.3 had a number of major improvements to the language. PHP 8 is also a new major release with a number of major improvements. It also has new Just In Time compilers, which could speed up the language.

Given that upgrading to a new release of a language pretty much requires testing and updating all your sources in that language, you might see why companies and individuals might be reluctant to upgrade. What do you get with the new release that you might want? What does "supported" mean that you might want? I personally still have code that i wrote in the 1980s that i have not updated to the 1987 ISO C version. Modern compilers still compile it. The executables produced still function, but when compiler warnings are turned on there are warnings. I'm OK with it. It's quite a bit of code. I'm not supporting hundreds or thousands of users with it. I don't generally use C language features newer than 1987 ISO C. I'd use them if I needed them. I still use C for performance and stability. Typically, when i upgrade my operating system, i get a newer C compiler, and i recompile all my relevant sources. PHP 5 introduced closures and lambda functions, things i use in Scheme and other languages. PHP 8 introduces many things that improve speed, reliability of the code and reduce bugs that the programmer might make. These are things i would like and use were i currently using it. Last time i was using PHP intensely, neither PHP 5 nor PHP 8 were yet available. I wasn't overly fond of the language. This may have changed. Google's Go language is also changing rapidly, and it appears it's changing for the better. IMO, Go has started with a better design and the implementation may be ahead of PHP.