@dgregor79@sfba.social avatar

dgregor79

@dgregor79@sfba.social

Dad, husband, Swift language designer and Swift/C++/ObjC compiler implementor, Author, Generic Programming aficionado. He/him.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

dgregor79, to random
@dgregor79@sfba.social avatar

2021 me did a quick temporary hack to unblock a critical feature.

2024 me just tripped over it in the dark and fell flat on his face.

2024 me is not amused with 2021 me.

Gandalf saying “I have no memory of this place”

finestructure, to random
@finestructure@mastodon.social avatar

Folks who squash their merges, I’m curious why you are making that trade-off. I’m guessing the pro argument is a cleaner merge graph?

The big argument against it for me is that you lose granularity for git bisect. I've often been able to narrow down breakage (sometimes long past the merge) due to individual commits in the merge. If I'd merged in a giant blob all I'd have had to go by is that giant blob. (1/2)

dgregor79,
@dgregor79@sfba.social avatar

@fabianfett @finestructure I recently landed a PR to SwiftPM where one commit in particular was of the form “temporarily work around a bug in an old Swift compiler.” The change was otherwise nonsensical and would have been reverted trivially in the future… except that it all got squashed together with a pile of good code because that’s how SwiftPM is configured. I hate the destruction of history like that; it makes it harder to undo parts of a change when that’s needed (which is common for us), and robs us of the logical flow of how a change was introduced. I cannot be convinced otherwise.

finestructure, (edited ) to swift
@finestructure@mastodon.social avatar
dgregor79,
@dgregor79@sfba.social avatar

@finestructure I used this recently to get Swift installed on a fresh Ubuntu and was up and running within 5 minutes.

stroughtonsmith, to random
@stroughtonsmith@mastodon.social avatar

Does Swift's MainActor annotation actually do anything at runtime to ensure code is called from the main thread, or is it entirely a compile-time sanity check that might not play well across opaque binary/framework boundaries?

dgregor79,
@dgregor79@sfba.social avatar

@stroughtonsmith There's a compiler flag -enable-actor-data-race-checks that enables additional runtime checking for actors in existing compilers. Swift 6 is getting an improved version that's documented at https://github.com/apple/swift-evolution/blob/main/proposals/0423-dynamic-actor-isolation.md

dgregor79,
@dgregor79@sfba.social avatar

@stroughtonsmith it emits a check on entry to a synchronous, actor-isolated function that ensures it’s running on the right actor. The check itself is fairly cheap, but could add up in a. Tight loop. The Swift 6 implementation should have lower overhead, because it can limit checks to those places where it is interfacing with code that isn’t statically checked.

dgregor79, to random
@dgregor79@sfba.social avatar

It’s been about 15 years since C++0x Concepts were removed from the draft that became C++11. I sat down with Conor and Bryce to talk through the goals and design of C++0x concepts, and some of the similarities and differences with the C++20 feature that bears the same name. https://www.adspthepodcast.com/2024/05/03/Episode-180.html

paris, to random
@paris@hachyderm.io avatar

if you go to Paris and don’t take a cheesy pic to send to me, are we really even friends?!

🤪

dgregor79,
@dgregor79@sfba.social avatar

@paris “Hey Siri, when I arrive in Paris, remind me to send a picture to Paris.” (I have no plans to go to Paris, but I’ll hedge my bets)

dgregor79, to random
@dgregor79@sfba.social avatar

I’m proud of my friends, former colleagues, and the students of Indiana University Bloomington for standing up and making their voices heard in peaceful protest. I’m also terrified for them, because Indiana has always been a deeply red state that shows serious fascist tendencies, and these (as-yet unconfirmed) reports of snipers on the roof of academic buildings is an unnecessary, dangerous escalation on the part of the state. Stay safe out there.

dgregor79, to random
@dgregor79@sfba.social avatar

My more-than-a-decade-old Brother monochrome laser printer finally failed, so alas, I must replace it. With another Brother laser printer, of course. But this one has color! And was manufactured after AirPrint so I can print from my iOS devices. This is Progress!

dgregor79, to random
@dgregor79@sfba.social avatar

Every time I get a chance to use it, the swift-argument-parser library sparks joy: https://github.com/apple/swift-argument-parser

stroughtonsmith, to random
@stroughtonsmith@mastodon.social avatar

One of the big worries I had with Swift from the very start was how long it would take me to get back to building cross-platform apps and games if I adopted it.

Well, we're here, ten years later. Swift is robust, portable, and with C++ support easily handles Windows, the Windows App Platform, and now game dev through the magnificent work of @Migueldeicaza and SwiftGodot. I can build a game in Xcode and Godot that deploys to Windows, Linux and Android using Swift, and that's pretty f-ing cool

Little demo project, built with Swift and Godot, running on Windows 11. A character moves in 2D, a sprite sheet updates based on that movement, and there’s a text label that shows the Swift source file that its compiled from

dgregor79,
@dgregor79@sfba.social avatar

@Migueldeicaza @stroughtonsmith This documentation does appear on the Swift Package Indez, though, unless you’re talking about something else: https://swiftpackageindex.com/migueldeicaza/SwiftGodot/0.41.0/documentation/swiftgodot

dgregor79, to random
@dgregor79@sfba.social avatar

Hello C++ folks! I've started a blog series aimed at C++ programmers who are interested in learning . It teaches the breadth of the Swift language, but anchored in the features and idioms of C++. So if you know your Rule Of Fives and your SFINAEs and think you might be interested in Swift, I'd love to hear what you think. Part 1 is something you know of from C++ that Swift takes a bit further: value types. https://www.douggregor.net/posts/swift-for-cxx-practitioners-value-types/

dgregor79,
@dgregor79@sfba.social avatar

Part 2 explore's Swift's reference types and optional types. These notions exist in C++, but Swift has a different take on them: https://www.douggregor.net/posts/swift-for-cxx-practitioners-reference-types/

dgregor79,
@dgregor79@sfba.social avatar

Part 3 explores Swift's "extensions", something I dearly miss in C++. Member-or-free-function should be a syntactic choice, and no more. Details at https://www.douggregor.net/posts/swift-for-cxx-practitioners-extensions/

dgregor79,
@dgregor79@sfba.social avatar

Part 4 covers generics, whose design was inspired by the ideas of Generic Programming that had their first successes in the C++ Standard Template Library. Swift generics are separately-typed and a joy to use, but you'll have to leave template metaprogramming behind... more at https://www.douggregor.net/posts/swift-for-cxx-practitioners-generics/

dgregor79,
@dgregor79@sfba.social avatar

Part 5 covers type erasure. If you've used std::any or std::function (or their Boost predecessors), you know what type erasure is. In , it's part of the language and integrated with the generics system. Also along for the ride are "metatypes", i.e., types that are expressed as values, allowing for runtime discovery and computation. Details at https://www.douggregor.net/posts/swift-for-cxx-practitioners-type-erasure/

dgregor79,
@dgregor79@sfba.social avatar

Part 6 covers error handling. The throw/catch approach will be familiar to C++ practitioners, but most of the defaults are different in Swift from C++. Also, the 'Never' type is really quite something... https://www.douggregor.net/posts/swift-for-cxx-practitioners-error-handling/

krzyzanowskim, to swift
@krzyzanowskim@mastodon.social avatar

If you asked how @SwiftStudio going. Well... it been better. Apple just recently decided to shutdown API I use (to make things CLI cannot provide). I find it unexpected (to me, not to apple) move after many years. https://github.com/apple/swift-package-manager/issues/7440

I'm disappointed with a move in that direction and find that decision harmful for the third-party dev tooling ecosystem trying to adopt SwiftPM. IMHO.

dgregor79,
@dgregor79@sfba.social avatar

@helge @nickmain @heckj if you’re looking to embed a Wasm interpreter, there’s also WasmKit: https://github.com/swiftwasm/WasmKit

drahardja, to random
@drahardja@sfba.social avatar

A black teenage family friend was called the N-word in downtown Los Gatos, California today by some jackass on a motorcycle.

Racism has never gone away; this country was founded on it. It is always lurking just below a thin polite veneer.

dgregor79,
@dgregor79@sfba.social avatar

@drahardja Boo :(.

airspeedswift, to random
@airspeedswift@mastodon.social avatar

I guess I could have posted that on my blog, except the dust is pretty caked on at this point, needs scraping off.

dgregor79,
@dgregor79@sfba.social avatar

@airspeedswift +1 to also going on your personal blog

dgregor79, to random
@dgregor79@sfba.social avatar

Here I go building a personal website and trying to focus on content, and @twostraws dangles a shiny new static site generator to distract me.

JamesWidman, to random

i want to play with zig more, but for me the main stumbling block is the absence of a sane LSP server.

(If you're writing an LSP server and you find yourself implementing your own semantic analysis instead of using the compiler's semantic analyzer, you fucked up.)

dgregor79,
@dgregor79@sfba.social avatar

@JamesWidman This really depends a lot on how good the underlying parser and semantic engine are at dealing with broken code and returning answers quickly no matter what. If your compiler has lots of type inference that can be slow sometimes, or starts to fall apart when there are missing or severely broken inputs (say, a missing header/module with all the types you need), it might be a crappy foundation to build on.

dgregor79,
@dgregor79@sfba.social avatar

@JamesWidman So you have a project that had generated headers in it somewhere, and if it hasn’t been yet (or recently enough), you’re happy to just have… nothing? No code completion, syntax coloring, go-to-definition, nothing? Even for obvious stuff in the same file? This is not something I’d be okay with, and the user reports we get imply that most users expect their IDEs to keep being useful even in t e presence of errors in the code.

It’s certainly possible to build the foundations of your compiler so that they can be used by IDE tooling, but you don’t get there by treating the IDE like a compiler. I think it’s the other way around—build your compiler like an IDE service, one function of which is to produce machine code.

dgregor79,
@dgregor79@sfba.social avatar

@JamesWidman it’s a silly principle to stand on when code completion fails to even show you local symbols due to one error. Tools that work with necessarily-incomplete code should degrade gracefully, not hard-fail.

dgregor79, to random
@dgregor79@sfba.social avatar

Ah, lovely. The old “vector reallocates while someone is holding a pointer into its storage” use-after-free, because of course C++ has no notion of memory exclusivity. No one is smart enough to use this language safely.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • magazineikmin
  • Youngstown
  • osvaldo12
  • khanakhh
  • slotface
  • tacticalgear
  • InstantRegret
  • ngwrru68w68
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • everett
  • rosin
  • JUstTest
  • Durango
  • GTA5RPClips
  • ethstaker
  • modclub
  • mdbf
  • cisconetworking
  • Leos
  • normalnudes
  • cubers
  • megavids
  • tester
  • anitta
  • lostlight
  • All magazines