@lorentey@mastodon.social
@lorentey@mastodon.social avatar

lorentey

@lorentey@mastodon.social

Swift Standard Library at Apple

he/him 🏳️‍🌈

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

nicklockwood, to random
@nicklockwood@mastodon.social avatar

tip: if you need to bind a non-optional value to a temporary variable inside a conditional statement, you can use case let, e.g:

if indexPath.section < sections.count,
case let section = sections[indexPath.section],
indexPath.row < section.rows.count,
case let row = section.rows[indexPath.row],
row.isEnabled
{
...
}

This saves you needing to split up the condition into multiple statements, and polluting the local namespace with temporary variables you don't need again.

lorentey,
@lorentey@mastodon.social avatar

@ctietze @nicklockwood Just popping in to note that there is only one String.Index type, shared across all string views. (The indexing model would in fact be simpler to understand/implement if each view had its own index type, but that was deemed too inconvenient. Nevertheless, creating named wrapper types to implement ad hoc subtypes is a highly useful technique, and it should be encouraged and normalized, rather than ridiculed.)

krzyzanowskim, to random
@krzyzanowskim@mastodon.social avatar

deleted_by_author

  • Loading...
  • lorentey,
    @lorentey@mastodon.social avatar
    lorentey, to random
    @lorentey@mastodon.social avatar

    Current status: sinking back into electronics to teach 3d printed things to move. It’s a hobbyception!

    lorentey,
    @lorentey@mastodon.social avatar

    It’s alive! 👨🏼‍🔬🔬🔭

    video/mp4

    lorentey,
    @lorentey@mastodon.social avatar

    @schwa Not that much — IIRC about 4 days for the four digits! Lots of 2-hour prints, with a few 5-6 hour long ones sprinkled in

    lorentey,
    @lorentey@mastodon.social avatar

    Cleaning up the rat’s nest at the back will be a nice project for another day

    video/mp4

    ctietze, to random
    @ctietze@mastodon.social avatar

    @lorentey I read your 2021 forum post that a mutable SortedArray would be impractical after ~2000 items
    https://forums.swift.org/t/add-sortedarray-sortedset-and-sorteddictionary-with-binary-search/47303/2

    Is that because of resizing the array or the search that is required to look for a fitting index, or both?

    Do you have benchmark code lying around by chance?

    lorentey,
    @lorentey@mastodon.social avatar

    @ctietze This is primarily because insertions and removals have complexity that’s linear in the size of the array — they have to slide existing items to make room for a new one or to close gaps after a removal.

    Arrays have benefits on small sizes because they are compact. Beyond a couple thousands or so items, this advantage is entirely eclipsed by all these movement costs: they become unbearably slow.
    [1/2]

    ctietze, to random
    @ctietze@mastodon.social avatar

    Anyone else still mad at 's index(_:offsetBy:limitedBy:) being so cumbersome to use with endIndex? 🤚

    lorentey,
    @lorentey@mastodon.social avatar

    @ctietze that but mostly the fact that it fails to indicate just how many steps it did manage to take 😞

    lorentey, to random
    @lorentey@mastodon.social avatar

    Americans will do anything to avoid using sensible date formats

    lorentey, to random
    @lorentey@mastodon.social avatar

    Noodle turned one year old today! 🐶

    lorentey, to random
    @lorentey@mastodon.social avatar

    Achievement unlocked: I spent a day playing with corrosive hydraulic break fluid without incident, then over dinner I proceeded to splash some spicy ramen directly in my eye

    lorentey, to random
    @lorentey@mastodon.social avatar

    Breaking news: I have just fallen over in spectacularly silly slow motion while trying to get off my bike, directly in front of my neighbor.

    Damages: one slightly scraped knee, one irreparably shattered self esteem.

    (I was on a borrowed bike and it was set slightly too high for me! 🤭)

    lorentey, to random
    @lorentey@mastodon.social avatar

    🚢 swift-collections 1.1.0 is out, shipping Heap, TreeSet/TreeDictionary and BitSet/BitArray types
    https://github.com/apple/swift-collections/releases/tag/1.1.0

    lorentey, to random
    @lorentey@mastodon.social avatar

    Good news: I got my new shots for Covid & the flu 🎉

    Bad news: I had to stop on the way to CVS to clean my glasses, but it didn’t help — the smudge is in the air. Fire season is here again. 😳

    lorentey, to random
    @lorentey@mastodon.social avatar

    Initial report from my New York expedition:

    • Big
    • It smells like home
    • The Met has some pieces of art on display
    • The natives seem friendly
    • The quality of food in museum cafes seems inversely proportional to the quality of objects on display
    • The subway rats are adorable
    lorentey, to random
    @lorentey@mastodon.social avatar

    Oh gosh, Swift atomics have been accepted! ⚛️ 🎉 This was really quite arduous to bring up, with dozens and dozens of alternative API designs tried, even ignoring all the compiler-level work. We agonized over every detail.

    The final variant includes some great API refinements over the swift-atomics package, courtesy of m’colleague Alejandro — the actual atomic operations are no longer coming from protocol requirements! 🧙🏼‍♂️

    https://forums.swift.org/t/accepted-with-modifications-se-0410-atomics/69244/3

    lorentey, to random
    @lorentey@mastodon.social avatar

    The Snoopy watch face is delightful!

    lorentey, to random
    @lorentey@mastodon.social avatar
    lorentey, to random
    @lorentey@mastodon.social avatar

    A wild Swift evolution pitch appears! It overhauls some fundamental Standard Library constructs to allow building things using noncopyable types. It's super effective, I hope

    https://forums.swift.org/t/pitch-noncopyable-standard-library-primitives/71566

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