[swift-users] Comparing POP to OOP
hoffman.jon at gmail.com
Wed Mar 9 20:19:47 CST 2016
> On Mar 9, 2016, at 11:51 AM, Dave Abrahams <dabrahams at apple.com> wrote:
>> On Mar 8, 2016, at 4:57 PM, Jon Hoffman <hoffman.jon at gmail.com <mailto:hoffman.jon at gmail.com>> wrote:
>>> On Mar 8, 2016, at 2:38 PM, Dave Abrahams <dabrahams at apple.com <mailto:dabrahams at apple.com>> wrote:
>>> on Tue Mar 08 2016, Michael Ilseman <milseman-AT-apple.com <http://milseman-at-apple.com/>> wrote:
>>>>>> What makes protocols in Swift different from Java interfaces (or
>>>>>> Objective-C protocols for that matter) is that they support static
>>>>>> polymorphism and generic programming.
>>>>> Unless I am misunderstanding what you are saying here, Java
>>>>> interfaces do support generic programming:
>>>>> https://docs.oracle.com/javase/tutorial/extra/generics/simple.html <https://docs.oracle.com/javase/tutorial/extra/generics/simple.html>
>>>> I think “static” is the operative word there.
>>> Actually, “generic programming” are the operative words. I don't mean,
>>> “does the language have a feature that it calls ‘generics?’”, I mean “does
>>> it support the discipline of generic programming?”
>>> http://www.osl.iu.edu/publications/prints/2005/garcia05:_extended_comparing05.pdf <http://www.osl.iu.edu/publications/prints/2005/garcia05:_extended_comparing05.pdf>
>> I have always looked at Generics from a Java point of view because that is the language in which I started really using them with my code.
> Yeah, but it's not about "Generics." ;-) It's about Generic Programming, which is about raising algorithms to a higher level of generality and applicability without loss of efficiency. It's the foundation of the Swift standard library and close to the heart of Protocol-Oriented Programming. If you're going to be writing about POP, you really need to understand it. I very strongly recommend the Stepanov and Rose book linked above as a way into the topic (and see the reviews on Amazon <http://www.amazon.com/Mathematics-Generic-Programming-Alexander-Stepanov/product-reviews/0321942043/ref=cm_cr_arp_d_paging_btm_next_2?ie=UTF8&showViewpoints=1&pageNumber=2>).
Thank you for the pointer. I will definitely check out the book you mention. If I have any questions, I will let you know :)
>> I did start reading the document during my daughter’s TaeKwonDo class tonight and it does seem pretty interesting. I will have to make time to read it in the next few days. Page 4 of the document has a chart that shows how the different languages compare. I can see, just from the top of my head that Swift has better support than some of the languages however not as well as Haskell or SML. How do you see Swift currently comparing to the other languages and how do you see it comparing in the future?
> Swift is still a very young language and there's lots we still want to do to improve support for generic programming (see the thread [Manifesto] Completing Generics <http://news.gmane.org/find-root.php?message_id=B51F92BB%2dA966%2d4260%2d91A5%2d12772F771AD2%40apple.com>). I expect we won't adopt all of the features of those other languages because some of them do not have a high enough value-to-complexity ratio.
I have only had a chance to glance through the Manifesto (been an incredibly busy day) but it looks like you have your work cut out for you :). I will have to go through the Manifesto more once I get through the PDF you pointed me to and the book. Feels like I went back to school :).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users