[swift-users] Comparing POP to OOP

Marco S Hyman marc at snafu.org
Tue Mar 8 18:49:34 CST 2016


>> You're going to use reference types in the *implementation* of any type
>> that has arbitrary growth.  Array uses a reference internally.
> 
> Actually we should be able to make a decent stack out of a value type without a reference type behind it.  Something like this:
> 
> enum Stack<T> {
>     case Empty
>     indirect case Node(T, next: Stack<T>)
     ^^^^^^^^

Uses a reference internally :)

Marc



More information about the swift-users mailing list