mastodon.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
The original server operated by the Mastodon gGmbH non-profit

Administered by:

Server stats:

347K
active users

David Smith

In the hopes that it saves someone else some frustration…I just discovered you can't have an object in your project with the same name as one of the new Swift Macros. If you do you'll get the not super obvious error “No macro named X”.

I just ran into this because I had a view named "Preview" in my project which meant that if I tried to use any of the new options, my project wouldn't compile. Renaming my class completely fixed this.

That look longer than I'd like to admit to work out.

@_Davidsmith that’s why it’s nice to program in another language (for me french), all your names pop up and can’t be mistaken as system names.

@_Davidsmith I’m guessing you could work around that with .Preview (or whatever module it lives in). Not a great error though! Also you’d have to update all your previews, yuck.

@_Davidsmith @siracusa I don’t understand why Swift doesn’t implement proper namespaces

@elias @_Davidsmith @siracusa it is namespaced to the module but this is usually inferred. This is a bad error message as it doesn’t understand the true problem here. Which is that of a name clash across modules. You get it with Swift a lot though when they add things that take your previously fine name… :(

@elias @_Davidsmith @siracusa this. In an effort to simplify Swift code, they’re making it more frustrating.

@_Davidsmith Wow that must have been infuriating,..

@_Davidsmith @nicklockwood for all their laudable goals of utility, swift diagnostics really suck, especially in result builders.

@JetForMe @_Davidsmith diagnostics tend to trail functionality, and a lot of these features were rushed to production to hit WWDC release schedule, so I'm hoping there's still potential for improvement.

@JetForMe @_Davidsmith @nicklockwood I *think* they announced that result builder diagnostics would improve this year