Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
They're a great exploration into what's possible, but there's a few steps in between that and a library you should actually use in real applications.

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
It seems to be more of the size of the target than the size of the current file, since I've had no syntax highlighting/autocomplete on five-line files plenty of times.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Are there non-obj-c reasons for the first argument being different? It makes sense for calling obj-c defined things since you'd need some crazy heuristics to split the method name from the first argument label, but not so much for pure Swift.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
You still need final even with virtual, so it's not really an "instead" thing.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
code:
let result = {
    switch opcode {
            case (0x0, 0x0, 0xe, 0x0) : return clearScreen()
            case (0x0, 0x0, 0xe, 0xe) : return returnFromSubroutine()
            case (0x1, let n1, let n2, let n3) : return jump(decodeThreeBytes(n1, n2: n2, n3: n3))
            case (0x2, let n1, let n2, let n3) : return callSubroutine(decodeThreeBytes(n1, n2: n2, n3: n3))
            ......
            case (0x8, let x, let y, 2) : return logicallyCombineRegister(x, withRegister: y, operation: .And)
            case (0x8, let x, let y, 3) : return logicallyCombineRegister(x, withRegister: y, operation: .Xor)
            default: return .Failed(reason: "Invalid instruction ")
    }
}()

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Typealiasing a tuple is probably not ever a sensible thing to do. Outside of generic programming scenarios where you can't use a struct with meaningful names, the main reason to use a tuple is where a struct would be pointless boilerplate. If you're using a specific type of tuple enough places to justify a type name, then defining a struct instead is not massively boilerplate-inducing.

There's definitely nothing wrong with a struct with zero methods.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I don't see the benefit. You haven't actually reduced the amount of code at the call site or factored anything out.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Defer puts the cleanup code next to the code creating the thing which needs to be cleaned up rather than as far away as possible (and is pretty useful even in the absence of exceptions).

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
It works, but using try-finally just for cleanup from multiple returns would be weird and misleading.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Does "not a priority" mean that it's something you think may get added at some point in the distant future, or is it something you don't expect to ever happen?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Ender.uNF posted:

Is it the preprocessor?

Maybe there's also some better reason, but the preprocessor is the usual reason for lovely names. Doing #define nullable const before including the Foundation headers was previously legal (if insane) so adding nullable would be a breaking change, while #define _Nullable const is not legal.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Installing Xcode 6 and 7 side-by-side works fine. I've been switching between them many times per day ever since the first beta came out, and literally the only problem I've encountered is that you have to explicitly exit the simulator when switching or dumb things happen.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Ender.uNF posted:

That stops being so much fun when you have to keep an iOS 9 branch going while working on other feature branches. You basically can't interact with the iOS 9 branch.

Maintaining Swift 1.2 and Swift 2.0 versions of code has certainly been an utter nightmare, but having to keep track of which copy of Xcode I'm looking at is one of the smallest of the annoyances. I guess not being able to use the iOS 9 SDK with Swift 1.2 is an unnecessary headache.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Implementing NSFastEnumeration only lets you iterate it from objc. To make it enumerable in swift you have to implement SequenceType.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Official announcement is up, although the linked repos are still private. In addition to the obvious things it includes Foundation, XCTest, and a package manager.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
It's apparently a reimplementation of Foundation's API without any obj-c involved, which seems like an odd choice to me.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Removing function currying's the bigger one (and also one that I agree with, as I've never actually seen it used).

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Ender.uNF posted:

Does anyone know if us plebs can get Xcode to use a custom build of swift or sourcekitd? I haven't looked into it yet.
I haven't actually tried it, but the build script can produce an xcode toolchain, and at least for clang those made it pretty trivial.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

ultramiraculous posted:

Gotta make that impact. Get your name out there!

The endless PRs that fix a single typo in a comment are a slightly less obnoxious form of that.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Er, is there something beyond https://github.com/apple/swift/tree/master/tools/SourceKit to open-source? There isn't really user documentation but it appeared to have all of the actual functionality.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I think the C API currently just exposes the IDE support functionality, which is basically just "tokenize this string" and "tell me about whatever's at this offset". For an AST you'd have to access the guts of the implementation (for Swift Jazzy just tokenizes the file then does the equivalent of alt-clicking each token and then reconstructing the structure).

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Well there's a few other projects built on sourcekitten, but obviously they'll all just use the same bit of SourceKit functionality so they aren't very interesting.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Flobbster posted:

It kind of makes sense that public things wouldn't get stripped since they might be needed elsewhere in the general case, but this case is surprising since it's linking into an executable so it's not going to be linked into something else that would try to use that function.
This isn't strictly true, as with great care it's possible to dlopen() mach-o executables. Exporting all public symbols from an executable shouldn't be the default, though...

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
If gyb was built into the compiler/build system we totally wouldn't need any new language features ever again.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Swizzling methods is far worse than anything in swift.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

squidgee posted:

:agreed:

I wasn't that heavy into Swift, but as I've used it more I really, really dig it, and wish I could use it for my full stack (:rolleyes:). I can't wait for the server-side frameworks to mature - I'd love to swap out Flask for, say, Vapor.

rjmccall can you confirm or deny that the wwdc surprise will be compiling swift to js so that we never have to use any other language?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Yeah, it's been a while since I last looked at ComponentKit, but I'm pretty sure a Swift enum with defaults for the associated values is exactly what it wants.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
That went through the standard swift-evolution process and has been in the preview toolchain builds.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Flobbster posted:

I don't see why everyone is so up in arms about sealed-by-default classes anyway. You already can't subclass value types, and I've found myself writing way more of those than class types nowadays. And the class types I *do* write tend to be just because I need reference semantics and I make them final anyway. People complaining that they need to be able to subclass to "fix bugs" are poo poo out of luck if they have a struct, and that's a terrible justification/use for inheritance anyway. I'm glad the core team feels really strongly about this one so it doesn't get derailed.
AFAICT most of the people opposed to it don't actually use Swift and only care about what happens to Swift because they assume they'll be forced to use it in the future, so they won't have noticed that sort of thing.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I don't think it has auto-expiring filters, but the other parts can be done easily with gmail.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Swift 4 trip report: updating 10k lines of Swift to compile without warnings as Swift 3.0, 3.1, 3.2 and 4.0 took about 4 hours and involves 12 #if swift(...) checks, most of which are for XCTest changes rather than Swift itself. Definitely the least painful migration by a huge margin (and the first time we've been able to reasonably support two major versions on a single code base).

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
SPM 4 still only supports macOS.

The last time I poked it at it, it appeared that being able to set the C++ version was the only hard blocker for us being able to support a spm package so I would expect most obj-c libraries to work in theory.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I always assumed that iOS support was on the roadmap once they had all the core functionality working because no one actually writes macOS applications anymore so why would you waste time building a macOS-only package manager? I guess if the actual goal is to use it to build macOS itself (and the bundled applications) it'd make sense.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Every time I try to do something with generics I end up wishing I was writing C++. Protocol constraints are nice in theory but I seem to inevitably waste hours trying to work around limitations of the type system.

Today's annoyance is that optionals of equatable types have operator == but are not equatable because there's no conditional protocol conformance.

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I think it's in the generics manifesto, so it's a "the design we picked is really hard and will take years to implement" thing.

  • Locked thread