Seems Swift has no way to namespace functions aside from methods on data structures. Seems too OO; maybe I missed something?
Conversation
Yes, static funcs on structs is typical practice now. I imagine we’ll get qualified imports eventually.
1
Thanks Andy, I appreciate the response :) Might it be more preferable to use enums instead of structs if there's no data?
1
Replying to
Don’t think it matters in terms of codegen, if we’re talking static funcs.
Replying to
I hadn't thought of codegen. Pedantic, but looks like the enum generates ~8 lines fewer SIL code, and maybe avoids an alloc.
1
Why would there be an alloc? We’re talking about static methods, yeah?
1
Show replies

