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
It's apparently a reimplementation of Foundation's API without any obj-c involved, which seems like an odd choice to me.

Adbot
ADBOT LOVES YOU

Doctor w-rw-rw-
Jun 24, 2008
Developed under Apple's banner, with their name taking the reputation hit it if sucks rear end (it won't) is good enough for me, I think, because a) it aligns their incentives with making it not crap, b) it'll be consistent across platforms to the degree it can be, and c) they have the technical resources on hand to refer to with regards to issues with the original Foundation implementation. And it means also that maybe they'll adopt Swift's Foundation over time – maybe.

Also, a commitment to make libdispatch a better option on non-Darwin platforms is very, very welcome news. Now Linux people can (officially) see the light of GCD*!

* yeah, yeah, it wasn't impossible before, with libpthread-workqueue, but again, official support is awesome

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Congrats, rjmccall!

nah thanks
Jun 18, 2004

Take me out.

Plorkyeran posted:

It's apparently a reimplementation of Foundation's API without any obj-c involved, which seems like an odd choice to me.

That explains why it took so long. That's quite the undertaking.

Nice to see that (based on comments, since Swift.org has been crushed by the traffic) Apple open sourced all of the basics necessary to make Swift useful for backend programming. I was concerned they were going to open source the language and nothing more. Granted that would have been at odds with their stated goals of making Swift a systems language, but you never know.

Hopefully this means useable web/backend frameworks will start popping up. Exciting stuff!

Doctor w-rw-rw-
Jun 24, 2008
Now I'll have to satisfy my neckbeard impulse to demand virtually impossible things by complaining that Core Data isn't open-source!

No but seriously, I am seriously stoked to see/use/program Swift on the backend.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Man, they told us 10am, I thought I had plenty of time to come in and vaguepost.

Yeah, we definitely recognized the need to deliver a richer library experience on other platforms. C interop is one thing, but the POSIX APIs are pretty creaky, and there's not really much of an accepted higher layer on top of most of them at the C level.

My hope, and to a degree my expectation, is that the Foundation APIs will evolve in a Swiftier direction as the community begins to drive that development; but they're a fine basis from which to start the discussion.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Sooo cool! It's not that I didn't believe it would happen, but you just never know until it does. Congrats!

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
Accepted proposal: Remove the ++ and -- operators :munch:

nah thanks
Jun 18, 2004

Take me out.

I'm torn between :negative: and :munch:

Subjunctive
Sep 12, 2006

✨sparkle and shine✨


I love it. Too few languages get that sort of thoughtful design attention to existing features after they're in production use. I'm occasionally annoyed by Swift compatibility woes (mostly when bisecting), but I'm mostly jealous that they can keep refining the language so substantially.

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).

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
++/-- was a fun conversation internally. I got to lead a faction that stubbornly withheld support until Chris gave in and admitted that Swift 3 was a major source break and that we would need to plan around that.

Anyway, go read the Better Translation of Objective-C APIs Into Swift proposal.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Subjunctive posted:

Congrats, rjmccall!

Doh004
Apr 22, 2007

Mmmmm Donuts...
Yeah this is more super cool stuff :respek:

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

rjmccall posted:

My hope, and to a degree my expectation, is that the Foundation APIs will evolve in a Swiftier direction as the community begins to drive that development; but they're a fine basis from which to start the discussion.

So loving pumped for this, rjmccall.

xgalaxy
Jan 27, 2004
i write code
So with Swift open source I'm curious how new libraries are going to be developed using it. Isn't there a concern that the ecosystem is going to be a bit confusing when some Swift "general purpose" libraries won't work on anything but iOS, or whatever, just due to the nature of the dependencies being relied upon? Will we see a pattern where these libraries move away from iOS/OSX specific dependencies to platform agnostic dependencies so that they can work on Linux. Take Alamofire for example, which uses NSURLSession.

I guess it would be no more confusing than C/C++, and perhaps this is something the Swift Package Manager is also trying to address.



EDIT: I just saw the the foundation stuff. Okay thats pretty neat then.

xgalaxy fucked around with this message at 20:08 on Dec 3, 2015

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Congrats to rjmccall and the whole team on what must have been a massive amount of work. You even imported the entire SVN commit history which is extremely brave.

I'm pleasantly surprised to be wrong(-ish) about the Foundation thing!

Some of the proposals in the swift repo are quite interesting, including concurrency. It is also interesting to see how some features evolved or what was rejected.



I'm probably going to be useless for the rest of the week as I spend my time browsing the sources and reading up.

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.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Ender.uNF posted:

Congrats to rjmccall and the whole team on what must have been a massive amount of work. You even imported the entire SVN commit history which is extremely brave.

We did have to munge a few things — internal codenames, privileged presentations, that sort of thing — but yeah, the whole semantic history of the actual code base is intact.

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.

Toady
Jan 12, 2009

Doctor w-rw-rw- posted:

Now I'll have to satisfy my neckbeard impulse to demand virtually impossible things by complaining that Core Data isn't open-source!

There's already a GPLv3 relicensing PR, in addition to the expected typo PRs.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Toady posted:

There's already a GPLv3 relicensing PR, in addition to the expected typo PRs.

And a million comments on the first commit. It's highly annoying.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Ender.uNF posted:

And a million comments on the first commit. It's highly annoying.

Gotta make that impact. Get your name out there!

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.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Plorkyeran posted:

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

• Contributor to open-source Swift project since December 2015

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull

Toady posted:

There's already a GPLv3 relicensing PR, in addition to the expected typo PRs.

The GPL license PR is from "mooman219", the trolls are coming from inside the forums

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Evolution proposal: call the package manager for Swift "tailor".

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



swift ev proposal, murder everyone who makes grammar PRs

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
I just saw a typography PR go by. They reformatted a document to use French spacing. One of my documents. Animals.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



rjmccall posted:

I just saw a typography PR go by. They reformatted a document to use French spacing. One of my documents. Animals.

Burn them!

Doh004
Apr 22, 2007

Mmmmm Donuts...

Figure a guillotine would be more appropriate!

lord funk
Feb 16, 2004

I need to create an UnsafeMutablePointer of either type UInt16 or UInt32 to match an MTKSubmesh's MTKIndexType. I'm having trouble with the syntax.

This doesn't work, but should show what I want:

code:
let Type = (mtkSubmesh.indexType == .UInt16) ? UInt16.self : UInt32.self
let pointerToIndexData = UnsafeMutablePointer<Type>(buffer.contents())
How would I do this?

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

lord funk posted:

I need to create an UnsafeMutablePointer of either type UInt16 or UInt32 to match an MTKSubmesh's MTKIndexType. I'm having trouble with the syntax.

This doesn't work, but should show what I want:

code:
let Type = (mtkSubmesh.indexType == .UInt16) ? UInt16.self : UInt32.self
let pointerToIndexData = UnsafeMutablePointer<Type>(buffer.contents())
How would I do this?

I'm pretty sure this isn't possible for a couple reasons:

1) There's no common type that the compiler can use for the variable in line 1 that would match both UInt16.Type and UInt32.Type
2) Because of that, you can't have a runtime decision decide the compile-time type of pointerToIndexData in line 2. You're asking pointerToIndexData to be UMP<UInt16> sometimes and UMP<UInt32> other times based on stuff happening while the program is running.

Can you do something like this instead?

code:
if mtkSubmesh.indexType == .UInt16 {
  doSomething(UnsafeMutablePointer<UInt16>(buffer.contents()))
} else {
  doSomething(UnsafeMutablePointer<UInt32>(buffer.contents()))
}

func doSomething<T>(pointer: UnsafeMutablePointer<T>) {
  // ...
}
Depending on what you're doing in that function, you'll probably want to add some constraints to T so the compiler lets you use the operations you want.

lord funk
Feb 16, 2004

Flobbster posted:

Can you do something like this instead?
Maybe, but I'm getting segmentation faults every time I drop the code in. :/ Hopefully finding the right constraints will stop that?

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
So is there a libclang-equivalent for Swift/does libclang support Swift and I'm just not using the right incantations? It seems like Realm devs are the only people really exploring this and they're exclusively using SourceKit calls they've sniffed out.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
SourceKit is supposed to be the libclang equivalent; it's just not open-source yet.

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.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
That's what I figured. Any tips on AST traversal?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Plorkyeran posted:

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.

Oops. I know there are some things around IDE integration we haven't open-sourced, and I'm phone-posting and couldn't remember if SourceKit was one of them. Good.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

ultramiraculous posted:

That's what I figured. Any tips on AST traversal?

I don't know the SourceKit interface at all, sorry.

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 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).

  • Locked thread