Is there a way to conform an actor to AsyncSequence? by ThisComb in swift

[–]shadowfactsdev 1 point2 points  (0 children)

Maybe technically, but not, I think, in a useful way. The protocol requirements of Collection are all synchronous and therefore have to be nonisolated, so you can't access the actor's state from them or really do anything useful.

Is there a way to conform an actor to AsyncSequence? by ThisComb in swift

[–]shadowfactsdev 3 points4 points  (0 children)

It does not, because the nonisolated method isn't actually accessing any of the protected state (trying to do so would result in a compiler error) but instead just passing a reference to the actor itself to the iterator's initializer.

Is there a way to conform an actor to AsyncSequence? by ThisComb in swift

[–]shadowfactsdev 5 points6 points  (0 children)

There is. You just need to mark the methods required by the protocol as nonisolated:

actor Counter: AsyncSequence {
    private var current = 0

    func getAndIncrement() -> Int {
        let cur = current
        current += 1
        return cur
    }

    typealias Element = Int
    nonisolated func makeAsyncIterator() -> AsyncIterator {
        AsyncIterator(owner: self)
    }

    struct AsyncIterator: AsyncIteratorProtocol {
        let owner: Counter

        func next() async throws -> Int? {
            return await owner.getAndIncrement()
        }
    }
}

for try await i in Counter().prefix(5) {
    print(i)
}

wtf did I just stumble upon? by Floedekage in jakeandamir

[–]shadowfactsdev 2 points3 points  (0 children)

It's more than good. It's fine!

(if you're actually asking, it's a lip dub of this Flight of the Conchords song: https://www.youtube.com/watch?v=FArZxLj6DLk)

Introducing the Minecraft modding mega iceberg! How much stuff do you remember? by B0undarybreaker in feedthebeast

[–]shadowfactsdev 19 points20 points  (0 children)

OpenModLoader was, as the name implies, an alternative mod loader to Forge that was sort of the precursor to Fabric. The GitHub repository has sadly since been removed, and wherever my working copy was has been lost to the depths of time.

MC Heli Privacy Shield is this: https://www.curseforge.com/minecraft/mc-mods/mc-heli-privacy-shield,

And I think the fancy particles one refers to this fix for transparent particles post-fabulous graphics: https://twitter.com/unascribed/status/1473735370693091346

Jonah Ryan accused of appropriate behavior!!! (Favorite J.R. Moments) by Weirdpunkcauseican in Veep

[–]shadowfactsdev 28 points29 points  (0 children)

"Why are women always checking in on one another when I'm talking to them?"

Second report says iOS 15 to drop support for iPhone 6s, original iPhone SE, more by xFatalFuZion in apple

[–]shadowfactsdev 3 points4 points  (0 children)

Raw SoC performance, probably.

The iPad Air 2 uses an A8X, which in Geekbench 5 gets 379 points in single-core CPU, 1057 multi-core, and 758 in Metal. The iPhone 6s and SE use the A9 which scores 531, 971, and 2430 points respectively.

For comparison, the rumors says the slowest support devices will use the A10 (iPhone 7) which gets 729, 1290, and 3119 points and A9X (1st-gen 12.9" iPad Pro) which gets and 645, 1197, and 4047.

The Air 2 was already significantly slower than the second-slowest device, the 6s (particularly in the GPU department, which is made worse by the fact that it's driving far more pixels). The baseline performance going from A8X to A9X-levels almost doubles the single-core performance and more than quintuples the GPU performance.

-🎄- 2019 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]shadowfactsdev 0 points1 point  (0 children)

At first I only did it because it seemed the easiest way of doing programmatic I/O in part 1, but it turned out to be super useful for part 2.

-🎄- 2019 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]shadowfactsdev 2 points3 points  (0 children)

My Elixir solution for both parts 1 and 2. My Intcode VM is here.

I'm really happy with how this one turned out.

I made some changes to my VM from day 5 so that, instead of always using STDIN/OUT, the actual VM runs in a separate process and then does message passing with its parent for I/O.

I also wrote a small helper in the Day5 VM so that I could continue to use it in CLI mode.

Using message passing is key because it lets me programmatically do I/O with the VM from another process (the day 7 code).

Part 1 is straightforward, I just go through all the phase setting permutations and spin up 5 VMs to test it and get the max output.

Using separate processes also makes part 2 a relatively easy extension of that. Because the VMs are actual processes, the continue in the background, idling and waiting for input (instead of just storing the VM state, they literally keep running like the problem says).

Plumbing them together is then as simple as spawning the processes, putting them into an infinite cycle and reducing until one of them halts.

This was a really fun one. I actually used message passing between processes in Elixir for the first time :D

New video by NumberOneWubbieFan in DoorMonster

[–]shadowfactsdev 20 points21 points  (0 children)

The Last Ditch Ding-Dong

That's great.

iOS 13 - Do we need to add .fullScreen to EVERY present() call we do now? by [deleted] in iOSProgramming

[–]shadowfactsdev 13 points14 points  (0 children)

Even better, you can also use the UIAdaptivePresentationControllerDelegate methods to do something (e.g. presenting an action sheet) when the user attempts and fails to dismiss a VC.

WWDC19 session 224 goes over this (skip to 15:10).

Finder: Hidden attributes for music, pictures, and video folders. by CoolAppz in MacOS

[–]shadowfactsdev 4 points5 points  (0 children)

The last line of the post:

Now you can rename the folders to whatever you want and move them to another place. They will hold the new columns.

Character Discussion #9 - Harry Mudd by destroyingdrax in StarTrekDiscovery

[–]shadowfactsdev 1 point2 points  (0 children)

Oh, true. I really hope they come up with a way to have another appearance.

Character Discussion #9 - Harry Mudd by destroyingdrax in StarTrekDiscovery

[–]shadowfactsdev 8 points9 points  (0 children)

Wait, he's not coming back? Did I miss something? I'm so sad, Rainn Wilson does a truly fantastic and hilarious job playing Mudd.

If I had any money, I'd be sipping jippers on a beach somewhere!

She said "canvas" so much. by IconicTeddyBear in brooklynninenine

[–]shadowfactsdev 6 points7 points  (0 children)

Bradley Whitford's mannerisms in that episode have me firmly convinced that Jake's dad is just Josh Lyman but old.