On Aug 10, 2014, at 9:56 AM, Quincey Morris 
<[email protected]> wrote:
> 
>> On Aug 10, 2014, at 06:46 , Roland King <[email protected]> wrote:
>> 
>> And if anyone thinks Swift is all simplicity and scripty loveliness I came 
>> across this StackOverflow question and answer today. It will be a while 
>> before I entirely understand it, it will be a long while before I could 
>> attempt to reproduce it.
> 
> Deliberately missing your point, I’d say the problem is that Swift has two 
> kinds of generics — one for class types and one for protocols. The concepts 
> are fairly easy to grasp individually, but become horrendously complex when 
> allowed to interact. Personally, I regard this as a bug in the language 
> design.
> 
> OTOH, C++ has historically proved that generics (i.e. templates)

I really wish people would stop referring to C++ templates as generics. C++ 
template arguments can be numbers, strings, types, or anything else, and the 
compiler will sit there and dutifully compute whatever program you encode via 
templates.

Generics are strictly type parameterization. They are far simpler to understand 
and implement. And Swift has some techniques to avoid some of the problems that 
arise even in “normal” use of C++ templates, like associated types (to keep 
generic type signatures simple) and a type inference algorithm that doesn’t 
completely suck.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to