Development

This Week in Programming: Specifically Generic

8 Sep 2018 6:00am, by

Last week, we looked at some of the announcements coming out of Gophercon 2018 — the latest version of Go, the preview into Go 2.0, and the now experimental module system birthed from vgo. Ever since the conference, a renewed debate has taken hold of the Go community, again focusing on the topic of “generics.”

My favorite of the various blog posts I saw on the topic this last week takes a stab at getting specific about generics. Penned by Google engineer (tho not GoLang team member) Emily Maier, the post dives into the history of the debate and offers some thoughts on where Go needs to, well, go.

“We first need to look at the fact that the term “generic” is itself generic, uh, overloaded (the two hard problems strike again). What the Go team is proposing (and what I think should be implemented by Go and any future language implementing “generics”) is bounded parametric polymorphism. Sadly, it has two false friends, code templating and implicit boxing, that are also called “generics” and are most famously implemented in C++ and Java respectively. When people talk about generics possibly being implemented in Go they often look to those two languages either as a source of inspiration or derision (mostly derision),” Maier writes, before diving into the details.

For those of you fuzzy on the topic, this tweet quickly describes the use of generics (and the controversy around them) in semi-layperson’s terms:

After comparing the various details, Maier comes to the conclusion that “It’d be far better to ship Go 2 with bounds support that’s too limited or not there than it would be to ship with something that causes compilation performance or usability problems, or to not ship any generics at all. The sooner people stop writing their own code templating systems or moving to more fully-featured languages, the better.”

DataDog developer Jason Moiron, meanwhile, offers his own take on the proposal. Moiron writes that, although he is against adding generics, “it’s indisputable that certain aspects of existing Go programs would improve with generics” and that “it’s very unlikely that a Go2 will ship without generics.” Similar to Maier, Moiron comes out against using contracts as a means to the end, writing that “the language of contracts feels too nuanced.”

And if you remain unsatisfied in your reading on the topic, fear not, you can also dive into Go contributor and team member Dave Cheney’s musings on the topic or Roger Peppe’s proposal for a revised design.

This Week in Programming

  • Python’s Perpetual Popularity Peaks: In less alliterative wording, Python has entered the TIOBE index top 3 for the first time. If you’re unfamiliar, the TIOBE index comes out once a month with a ranking of programming language popularity. So, there’s some longevity to it and some gravity to the fact that, after some decades, this is the first time that Python has reached this level of popularity. As they write, “This really took a long time. At the beginning of the 1990s it entered the chart. Then it took another 10 years before it reached the TIOBE index top 10 for the first time.” Accordingly, they cite the language’s ease of learning, installation, and deployment for its slow but steady rise to the top three. Meanwhile, Julia, which we took a look at a few weeks back as a potential replacement for Python or R, made the leap from #50 to #39 in the index.
  • Visual Studio Code’s Python Extension and More: Continuing on that Python train, Visual Studio Code came out with its round-up for new features for August 2018, which it says includes a “number of significant updates.” Among those significant updates are a settings editor, custom menu bar, breadcrumbs improvements, a new Terminal menu, platform-specific keyboard shortcuts, CSS @import path completion, JSON conditional evaluation, and built-in Loaded Scripts view. Beyond those, however, Microsoft also announced the release of the Python extension for Visual Studio Code. According to SDTimes, the release “features version 4.1.1 of Microsoft’s Python debugger, ptvsd,” which Microsoft claims is a “significant improvement over version 3.0 of the debugger” that is “now built on top of open-source project pydevd, enabling users to leverage its performance and support for third-party libraries.” Some new features introduced with this version of the extension include support for Logpoints, “which allows developers to add print statements without needing to stop code execution” and “several improvements to the preview for the Microsoft Python Language Server, a Python analysis engine hosted on VS Code.” Make sure to check out Microsoft’s blog post for the full list of improvements.
  • Kotlin/Native’s Major and Breaking Changes: Last up in our dot releases this week, Kotlin/Native v0.9 is here and promises some “major (and breaking)” changes, despite the numbering, of its compiler toolchain, Gradle plugin, and IDE plugin. According to the announcement, the most important changes announced include the migration to Kotlin 1.3-M2, support for unsigned types in Kotlin stdlib and in C/Objective-C/Swift interop layer, support for a stable version of kotlin.coroutines, reworked concurrency primitives, and the kotlin.native package. For details, check out the blog post or the GitHub release page.
  • Learning Blockchain with the Linux Foundation: For those of you still bullish on this whole blockchain thing, the Linux Foundation has launched a new blockchain courseLFD271 — Hyperledger Fabric Fundamentals — which is now open for enrollment. The course will cover core blockchain concepts and distributed ledger technologies, as well as architecture and components that comprise Hyperledger Fabric applications. The foundation notes that “Blockchain technology adoption is increasing at a rapid pace — with TechCrunch reporting blockchain jobs as the second-fastest growing in today’s labor market” and that “more than 100,000 students” took the foundations free introductory Hyperledger course, leading it to dive a bit deeper with this next course and upcoming certification.
  • Google Announces Dataset Search: As a developer, you may have been told before that your program is only as good as its data. Or not. Either way, there are blog posts aplenty out there saying as much. This week, Google announced its ” Dataset Search, so that scientists, data journalists, data geeks, or anyone else can find the data required for their work and their stories, or simply to satisfy their intellectual curiosity.” Of the announcement, TechCrunch writes, “Traditionally, datasets are spread far and wide across individual research websites, institutions like NASA and the National Oceanic and Atmospheric Administration — and even data-driven publications like ProPublica. With Dataset Search, Google is aiming to adapt its Google Scholar search scheme to help data geeks and researchers sift through this data in a single search bar.”
  • TomTom Announces Free Maps with Mobile SDK: We’ve recently talked a bit about Google Maps pricing, and now it looks like some mapping competitors are making moves to take advantage of dissatisfaction. TomTom this week announced free maps and traffic tiles on its mobile SDK, available for both Android and iOS. The publication also commented on the timing, remarking that “While TomTom did not mention the Google move onstage or in its press release, it’s hard to imagine Google’s new pricing scheme didn’t have something to do with TomTom’s decision. “TechCrunch, meanwhile, calls this announcement “part of the company’s overall transformation from a consumer device manufacturer to a software company.”
  • The Cost of Code Repositories: And finally this week, a story from our own pages on how even open sourcers pay for code repositories. Citing a survey conducted by The New Stack and The Linux Foundation, the story looks at how “half said they use a free, vendor-provided solution like GitHub, but 53 percent also pay for code repository software or services.” Of course, Microsoft’s acquisition of GitHub, and the resultant fear of monopoly, always comes to mind when discussing this topic recently, and the author writes that various surveys indicate that “there is little chance that Microsoft will come close to dominating the market for code repositories in the near future.”

Google and Microsoft are sponsors of The New Stack

Feature image via Pixabay.

A newsletter digest of the week’s most important stories & analyses.