←back to thread

Go subtleties

(harrisoncramer.me)
234 points darccio | 1 comments | | HN request time: 0.239s | source
Show context
jasonthorsness ◴[] No.45669948[source]
Great list! Reminds me to check out more of the new stuff in 1.25.

The one thing I wish Go had more than anything is read-only slices (like C#).

The one thing I wish more other languages had that Go has is structural typing (anything with Foo() method can be used as an interface { Foo() }.

replies(2): >>45670075 #>>45672522 #
mwsherman ◴[] No.45670075[source]
In Go, string effectively serves as a read-only slice, if we are talking about bytes.

ReadOnlySpan<T> in C# is great! In my opinion, Go essentially designed in “span” from the start.

replies(2): >>45670185 #>>45679279 #
1. pjmlp ◴[] No.45679279[source]
System languages from 1980's already had the span concept.

One way that you will find it is that they used to be called open arrays in some of them.