Late binding means you don't need to know the types of your parameters *at all* when you write a method call. If the language supported late binding, then you would be able to define all your variables as Object and *everything would continue to work*.
In Go you could define everything as interface{} and then use small interfaces around every call: foo.(interface{ Method() string}).Method() In Java, you can use the reflection interface. In this sense, it is available "on demand", but that's not the same thing at all. Both Java and C++ made the mistake of confusing a class with a behavior, and then using classes as names for behaviors. On Tue, Nov 22, 2022 at 11:46 AM Robert Engels <reng...@ix.netcom.com> wrote: > What would be the purpose of writing B calling a method on A that doesn’t > exist? > > On Nov 22, 2022, at 10:36 AM, 'Thomas Bushnell BSG' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > > Both Java and Go require that a method be instantiated in the declared > interface of the type at compile time. This is contrary to the point of > late binding. > > In the case of Go, this cannot be detected, because everything is built > together. But with Java, you cannot call a method on an object unless that > method has *already *been defined. In other words, late binding supports > the following order of things: > > 1) Write class A, with method X and only X. Compile it. > 2) Write class B, which instantiates class A and calls method Y (which > does not exist yet). Compile it. > 3) Extend class A to add method Y. Compile it. > 4) Execute class B. > > Late binding says this should work, but the Java compiler will throw an > error at step two. Go never throws that error, because Go only builds the > whole program at once, so the partial compilations don't make sense. > > In addition, any method marked final does not support late binding - > indeed, this is the point of the keyword, and is why I remarked that this > is because they couldn't figure out how to do it efficiently. > > Thomas > > On Tue, Nov 22, 2022 at 11:25 AM Robert Engels <reng...@ix.netcom.com> > wrote: > >> Why do you say that Java does not have late binding. It 100% does. In >> fact the JVM supports dynamic dispatch to make this as efficient as >> possible. Then the JIT optimizes it even more based on runtime behavior. >> >> On Nov 22, 2022, at 10:18 AM, Matt KØDVB <m...@k0dvb.com> wrote: >> >> >> But see https://en.wikipedia.org/wiki/Self_(programming_language) >> >> Self was considered an OO language back when I was a grad student and is >> still listed that way today, even though it has neither classes nor >> inheritance. >> >> Anyway, my point would be that the term OO originates with Alan Kay and >> the team at Xerox PARC; Kay’s response to the OO flame wars was to >> de-emphasize classes and inheritance. >> >> Of course, using his definition, neither Java nor Go would be “truly” OO >> since not all things use late binding :-) >> >> Perhaps we can talk about class-based and non-class based OO languages? >> >> On Tue, Nov 22, 2022 at 10:07 AM Robert Engels <reng...@ix.netcom.com> >> wrote: >> >>> The wiki OO page lists classes as a requirement - but not necessarily >>> inheritance. Class variables require classes. >>> >>> Also, your link does not work. >>> >>> > On Nov 22, 2022, at 9:56 AM, Jan Mercl <0xj...@gmail.com> wrote: >>> > >>> > On Tue, Nov 22, 2022 at 4:43 PM Robert Engels <reng...@ix.netcom.com> >>> wrote: >>> > >>> >> Go is not listed as an OO language on Wikipedia. >>> > >>> > Check https://en.wikipedia.org/wiki/Go_(programming_language): >>> > "ParadigmMulti-paradigm: concurrent imperative, object-oriented[1][2]" >>> > >>> >> Personally I think it is OO-like. OO typically has inheritance. >>> > >>> > Typically they may, but that's not the same as what a requirement >>> > would be, right? >>> > >>> >> There are also no “class variables” - only package level - which >>> makes some encapsulation patterns harder (every class has to become a >>> package). >>> > >>> > No class has to become a package because Go has no classes. You may >>> > think of what a "class" in Go means, but you have not defined that >>> > idea and the language specification is somehow silent about Go >>> > classes. >>> > >>> > -- >>> > 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/CAA40n-U%3DG8gqAZEHrnLUxbg5vsAcRkNV35c86c79xcrhSzLSWw%40mail.gmail.com >>> . >>> >>> -- >>> 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/A1F03B77-7CDC-46CC-B2E0-2C3C1B7DC966%40ix.netcom.com >>> . >>> >> >> >> -- >> >> Matt >> K0DVB >> >> -- >> 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/CANRS-2%2Bre6WUFT6tE8QinUZ-ipqLvwNTr2hoHNiD4H%3DwQ8T7HA%40mail.gmail.com >> <https://groups.google.com/d/msgid/golang-nuts/CANRS-2%2Bre6WUFT6tE8QinUZ-ipqLvwNTr2hoHNiD4H%3DwQ8T7HA%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/A5532469-6B1D-4C18-8DBE-F03FD56E8830%40ix.netcom.com >> <https://groups.google.com/d/msgid/golang-nuts/A5532469-6B1D-4C18-8DBE-F03FD56E8830%40ix.netcom.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%2BYjuxsQJu9KVOCR5xGK88yJ9w2FDNB9za_c%3DnvdGYZAvJbwWw%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CA%2BYjuxsQJu9KVOCR5xGK88yJ9w2FDNB9za_c%3DnvdGYZAvJbwWw%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%2BYjuxtGgC0%2B7AZZM8j%2BKLZyouUgye8epmTquY4ZApFhrocMpA%40mail.gmail.com.