[RFC] Make `Dwifft` an enum, not a struct
jessesquires opened this issue · comments
Jesse Squires commented
It looks like Dwifft
is only used as a namespace:
https://github.com/jflinter/Dwifft/blob/master/Dwifft/Dwifft.swift#L79
The problem with a struct
is that it can be instantiated, Dwifft()
. This isn't a problem now, since there are no instance members, but it is a bit awkward.
Changing this to enum Dwifft
(with 0 cases) provides the same effect of namespacing, except you cannot instantiate an enum
. 😄
See also:
Jack Flintermann commented
That makes a lot of sense, thanks for the proposal! I'd happily accept a PR
making this change.
…On Thu, Jul 27, 2017 at 12:59 PM Jesse Squires ***@***.***> wrote:
It looks like Dwifft is only used as a namespace:
https://github.com/jflinter/Dwifft/blob/master/Dwifft/Dwifft.swift#L79
The problem with a struct is that it can be instantiated, Dwifft(). This
isn't a problem now, since there are no instance members, but it is a bit
awkward.
Changing this to enum Dwifft (with 0 cases) provides the same effect of
namespacing, except you *cannot* instantiate an enum. 😄
See also:
- https://www.natashatherobot.com/swift-enum-no-cases/
- http://ericasadun.com/2016/07/18/dear-erica-no-case-enums/
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#67>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAtM5wHhny9apyBjl1gEfyERmsbpZVGWks5sSMH5gaJpZM4OlkR2>
.