Re: Does compile order matter for Swift files?
Re: Does compile order matter for Swift files?
- Subject: Re: Does compile order matter for Swift files?
- From: Steve Christensen <email@hidden>
- Date: Fri, 23 Jun 2017 11:35:39 -0700
On Jun 23, 2017, at 10:46 AM, Quincey Morris
<email@hidden> wrote:
>
> On Jun 23, 2017, at 06:02 , Steve Christensen <email@hidden
> <mailto:email@hidden>> wrote:
>>
>> Now, magically, the errors tab shows 6 errors across two files, neither of
>> which had errors before and the errors don't refer to anything in those
>> files. All of the other errors are no longer reported nor are they
>> highlighted in the source files.
>
> There are a couple of factors that might affect this.
>
> — It looks to me like Xcode will stop trying to compile source files after a
> certain number of errors (or number of files with errors, or …) is reached.
> That can mean the errors you see depend on the order in which the files are
> compiled.
Thanks, Quincey. I was wondering if it was something like that, especially
after looking at the compile command and seeing a -primary-file switch with the
name of the file being compiled, followed by a bunch of other source files.
> — It’s possible, especially when you’re early in development, to have so many
> missing/incorrect definitions that Source Kit gets confused and either
> crashes or stops analyzing source. If nothing else, that may mean errors
> can’t be tagged to specific source code lines.
At one point before I reordered the files there were something like 194 errors
being display so running into this particular issue when there are only 40
doesn't seem like I hit a limit, but who am I to guess? I didn't see any
compiler aborts or anything like that, just the expected linker error because
compiles failed.
> — Based on something I read recently, Swift jumps between files during
> compilation. In order to resolve mutual dependencies between definitions in
> different files, it may partially compile a declaration, then go partially
> compile a referenced declaration in another file. The pattern of referencing
> will affect the order errors are detected in.
>
> So the answer is probably that the order of the files affects the order in
> which Swift *starts* to compile them, and things get complicated after that.
Unfortunately then it seems like one could run into the situation I'm seeing
where few or none of the warnings or errors is displayed, and where it's not
obvious what happened.
>> Xcode 8.3.1
>
> Why not at least 8.3.2? That was the stable release for a long time. (8.3.3
> was a minor update around the same time as WWDC.)
I was in the middle of a project and not keeping up on the latest Xcode builds.
I'm downloading 8.3.3 right now for production work.
> And if you’re just starting to put effort into Swift development, why not
> Xcode 9? It seems counterproductive to put effort into Swift 3 when Swift 4
> is already here (almost). There’s enough different in Swift 4 to make it
> reasonable to skip Swift 3.
>
> Xcode 9 is still rough around the edges (more so than usual, because it has
> major reworking of a lot of things, especially a brand new source code
> editor), and not everything that’s coming in Swift 4 is fully implemented
> yet, but it’s a viable choice for a project you’re just starting out on.
Baby steps. I think that if I had been playing with Swift longer then that
would be reasonable but I could see situations where one of those rough edges
bites me because I don't yet know enough to distinguish between my coding
errors and someone else's. :)
Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden