Typo in Generic Types section of the swift-book, language guide

It would be much more useful to define a generic Stack class, that can manage a stack of any type of value.
Here’s a generic version of the same code:

struct Stack<Element> {
    ...
}

https://docs.swift.org/swift-book/LanguageGuide/Generics.html#ID184

I think that you should use a word type or struct instead of class.

3 Likes
Terms of Service

Privacy Policy

Cookie Policy