Another precedent for the idea was the use of a "behavior" to specify the methods which a Smalltalk object can receive. Basically, it was realized that the question of the class hierarchy for an object was an implementation concern which the users of an object should not care about. So early Smalltalk books started using the word "behavior" to refer roughly to something like a Go "method set". When Smalltalk standardization happened, the class hierarchy was almost entirely left out of the standard, instead relying on these behaviors to say what methods an object would support. Implementations could then make their own decisions about how to factor those into classes for implementation.
The main difference between these behaviors and Go's interfaces is that a behavior in Smalltalk is only a way to talk *about *the language; there is no such thing as a behavior datatype in Smalltalk, no syntax for specifying them, etc. It's a way to document what things do, but not something checked by the compiler. However, as soon as you have typed variables, and you would be deciding whether the types should be classes or behaviors, you would certainly pick behaviors (and thus something like Go's interfaces) as superior to classes (like Java or Python typically use). Thomas On Fri, Aug 25, 2023 at 12:27 AM Rob Pike <r...@golang.org> wrote: > It was dreamed up independently at the whiteboard on the first day of > design discussions. We did not know Emerald at the time; the similarity was > discovered later. > > This is not to claim the idea is original, just that we discovered it > independently. > > -rob > > > On Fri, Aug 25, 2023 at 1:57 PM Andrew Harris <harris.and...@gmail.com> > wrote: > >> The comments on Go Data Structures: Interfaces >> <https://research.swtch.com/interfaces> mention Emerald >> <http://www.emeraldprogramminglanguage.org>, maybe this is what you were >> thinking of? >> >> On Thursday, August 24, 2023 at 8:42:43 PM UTC-7 xie cui wrote: >> >>> I remembe someone in a video in youtube explain the design of interface. >>> But I cann't find it now. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/e873392b-47fe-4fa9-b465-efadcde0bfd8n%40googlegroups.com >> <https://groups.google.com/d/msgid/golang-nuts/e873392b-47fe-4fa9-b465-efadcde0bfd8n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAOXNBZQ8D5f2uLb1%3D8ttmnwzo7WY3vYqKu7W3Sz%3DqyQ3OmjfTA%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CAOXNBZQ8D5f2uLb1%3D8ttmnwzo7WY3vYqKu7W3Sz%3DqyQ3OmjfTA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2BYjuxtGcGxW_yWqot%2BeF%2BSVZyY%3DrSTXRKFp8FVh%3DezQ48WH9A%40mail.gmail.com.