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

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.

mattiem, to random
@mattiem@mastodon.social avatar

A Swift concurrency pattern I’m seeing more and more is the “stateless actor”. This is fascinating, because it seems so counterintuitive. But I think people are reaching for this to get convenient access to background processing.

I don’t think this is “wrong”. But I think it is probably building bad habits. Local, private nonisolated methods are usually simpler and better long-term.

dgregor79,
@dgregor79@sfba.social avatar

@mattiem @dimsumthinking I agree! If you have some work you want to move off to the background, mark the function nonisolated but otherwise leave it in place.

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, to random
@dgregor79@sfba.social avatar

Finally landed the first of many standard library updates to replace "rethrows" with generic typed throws: https://github.com/apple/swift/pull/69771. The feature has been a fantastic exercise in generalizing in place: it maintains the same behavior for existing Swift code, maintains the stable ABI of the standard library, and yet any Swift code that adopts typed throws will see typed errors propagate through the standard library in the natural way.

alexr, to random
@alexr@mastodon.online avatar

Can we convict him of insurrection and treason now, please?

And revamp Alcatraz just to hold him and the rest of his crime family associates?

dgregor79,
@dgregor79@sfba.social avatar

@alexr @schwa Just think of the tourist dollars it would bring in

dgregor79, to random
@dgregor79@sfba.social avatar

An undetected leak caused me to get an astronomical water bill this month. The San Jose Water Company gave me the polite version of the middle finger, so now it’s on to file a complaint with the California Public Utilities Commission. Now I’m basically drafting public policy in my CPUC complaint: smart meters can detect and report leaks immediately, yet water companies have been slow to roll them out. Seems to me that water companies should bear the cost for water overuse due to undetected leaks wherever they have failed to install a smart meter. Right now, they just pass the cost on to the consumer. This policy is better for both consumers and water conservation in general in our drought-stricken state, because it puts a cost on not installing smart meters.

dgregor79, to random
@dgregor79@sfba.social avatar

Real-time picture of me trying to figure out what my next commit should be even though I know the right answer.

dgregor79, to random
@dgregor79@sfba.social avatar

I had some fun today adding "subcommand group" support to the argument parser library: https://forums.swift.org/t/grouping-subcommands/72219

dgregor79,
@dgregor79@sfba.social avatar

@siracusa YOU MAY NOT LIKE IT, BUT THIS IS PEAK MAN PAGE STYLING, JOHN

dgregor79, to random
@dgregor79@sfba.social avatar

I’m not a car guy, but I’ve long held that I’ll replace my i3 when there’s a suitable fully-electric 4-seat convertible with good range. The Fisker Ronin looks amazing and ticks all of the boxes, but ouch that sticker price.

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.

dgregor79, to random
@dgregor79@sfba.social avatar

If you’re not yet totally sick of hearing me talk… part 3 of my interview on the ADSP podcast is up, where we talk about variadic templates, std::variant, and (finally!) some Swift: https://www.adspthepodcast.com/2024/05/17/Episode-182.html

dgregor79,
@dgregor79@sfba.social avatar

I did a bit of digging on the digit separators issue, and I think I have reconstructed what happened. Digit separators came in to the meeting with a couple of different possible syntaxes: underscores (like Swift has) would have been preferred (e.g., 1_000_000), but they conflicted with user-defined literals on hexadecimal literals (0x1000_beef is ambiguous).

So the syntax changed to use spaces as digit separators (e.g., 1 000 000), and I think that’s what was coming up for a vote. Some Clang folks (including myself) noticed an ambiguity with Objective-C’s message send syntax while trying to implement it (yes, at or near the bar; compiler people are weird), and alerted the committee. Digit separators did not pass at that meeting.

Eventually, C++ got digit separators with the tick (e.g., 1’000’000). It’s unambiguous, albeit a bit ugly IMO. I don’t think I’ve ever seen them used in practice.

jsq, to random
@jsq@mastodon.social avatar

“gasoline spaghetti” would be a great name for song

dgregor79,
@dgregor79@sfba.social avatar

@jsq can the song be about technical debt that’s going to cause your next deployment to go up in flames?

dgregor79, to random
@dgregor79@sfba.social avatar

Anything that a compiler allows a programmer to write, some programmer will have written, and you will discover that such code exists only at the most inconvenient time.

dgregor79, to random
@dgregor79@sfba.social avatar

The Language Steering Group has accepted the vision for Embedded Swift: https://github.com/apple/swift-evolution/blob/main/visions/embedded-swift.md

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.

dgregor79, to random
@dgregor79@sfba.social avatar

SE-0408 "Pack iteration" is under review now! This proposal makes it possible to use Swift's for..in loop with parameter packs in an obvious and powerful way. We'd love your input over at https://forums.swift.org/t/review-se-0408-pack-iteration/67152

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

dgregor79, to random
@dgregor79@sfba.social avatar

Yesterday’s coding journey involved making a ton of progress on a hard thing, and it started to work well on small examples… however, the way it fit in to the code base required some duplicate logic, and that made my implementation gross. So, now I’ll refactor all of the bits (fixing some little bugs found along the way), and take a second stab at the hard thing once everything is nice around it. This is coding at its most fun :)

dgregor79, to random
@dgregor79@sfba.social avatar

Saw my first Cybertruck in the wild today, and let me tell you… the pictures don’t prepare you for just how hideous this thing is. It’s just so awful.

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”

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.

dgregor79, to random
@dgregor79@sfba.social avatar

The fifth (and final!) episode of my guest appearance on the ADSP podcast is up! We talk about more , generics, Swift 6, and data race safety. https://www.adspthepodcast.com/2024/05/31/Episode-184.html

dgregor79, to random
@dgregor79@sfba.social avatar

Part 4 of 5 on ADSP, this time talking about Swift! https://www.adspthepodcast.com/2024/05/24/Episode-183.html

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