3

So, reading golang blog on slices there is a snippet by Rob Pike

A weakness of Go is that any generic-type operations must be provided by the run-time.

which I don't quite understand.

Can one rephrase same sentence?

Considering the context before and after this sentence I assume we can not program generic-type methods (consuming, let's say, slices of byte/int/float etc), but rather should use built-ins.

So, the quirkiest part for me is provided by the run-time, - is that equals to provided by the language?

Nemoden
  • 163

1 Answers1

5

So, the quirkiest part for me is "provided by the run-time," - is that equals to "provided by the language"?

Yes. What it means is that Go has a handful of built-in generic types, such as arrays/slices, channels, and maps, that can have any type put into them, but that's all you get; there's no support for defining your own custom generic types.

Mason Wheeler
  • 82,789