On Sat, Jul 11, 2015 at 11:44 AM, Jonathan S. Shapiro <s...@eros-os.org> wrote: > On Sat, Jul 11, 2015 at 8:33 AM, William ML Leslie > <william.leslie....@gmail.com> wrote: >> >> Protocols (as seen in Clojure, which Swift borrows from somewhat, and >> Go) are a bit more than interfaces. It's perfectly reasonable for a >> single 'type' to implement the same protocol in a variety of ways. At >> least, in Clojure; maybe they boogered this in the other languages. >> >> I guess they are more like bitc's original capsule concept. > > > William: Did you actually look at the Swift reference when you made this > statement? I don't see anything in the language specification that would > allow a protocol to be implemented in multiple ways. Clojure may allow that, > but Swift does not appear to do so. The things you can specify as > compatibility requirements in a Protocol are a bit richer than I've seen in > many other Interface specifications, but they don't step (conceptually) > beyond the idea that an Interface defines a contract about which methods > must be present.
I absolutely haven't and won't bother reading the swift reference, since I have less than zero interest in welding on the apple ball and chain and jumping through that looking glass again... but it is likely to just be a terminology usage due to objective-c. Objective-c had a different usage for the term 'Interface', this was the declaration of a class that would appear in a header file, containing the class name, its variables, and methods such as @interface FooClass { int foo; } - (void) setFoo:(int)aFoo; @end which comes from very early in the specification of objective-c by Brad Cox, before NeXT or apple was involved... from memory, and it has been a while. but IIRC one of the first things NeXT added were 'Protocols', which are essentially what you refer to as 'interfaces', (I'm not sure where this other usage of 'Interface' comes from, the first I heard of it was Java, which is still in some historical future)... thus it seems to me they are just sticking with the terminology they have always used, and their users are familiar with from their other language... but 2 options remain a) they renamed interfaces to protocols due to the existing conflict of terminology b) their usage of protocols predates the usage of interface and their sticking with it. Objective-c protocols could only do what William is talking about in a very convoluted way, by messing about with the method lookup tables in the language runtime, but that was in no way related or limited to Protocols... _______________________________________________ bitc-dev mailing list bitc-dev@coyotos.org http://www.coyotos.org/mailman/listinfo/bitc-dev