Great series of short articles introducing Apple's Metal framework.
- 2022-04-01: Day 1: Devices
- 2022-04-02: Day 2: Buffers
- 2022-04-03: Day 3: Commands
- 2022-04-04: Day 4: MTKView
- 2022-04-05: Day 5: Shaders
- 2022-04-06: Day 6: Pipelines
Great series of short articles introducing Apple's Metal framework.
As Swift evolves, it gains new language features and capabilities. There are different categories of features: some fill in gaps, taking existing syntax that is not permitted and giving it a semantics that fit well with the existing language, with features like conditional conformance or allowing existential values for protocols with Self
or associated type requirements. Others introduce new capabilities or paradigms to the language, such as the addition of concurrency or comprehensive reflection.
There is another large category of language features that provide syntactic sugar to eliminate common boilerplate, taking something that can be written out in long-form and making it more concise. Such features don't technically add any expressive power to the language, because you can always write the long-form version, but their effect can be transformational if it enables use cases that would otherwise have been unwieldy. The synthesis of Codable
conformances, for ex
I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.
The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.
You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.
# $ ruby ./bisect-toolchain-snapshot.rb swift-wasm-DEVELOPMENT-SNAPSHOT-2021-12-12-a swift-wasm-DEVELOPMENT-SNAPSHOT-2022-04-06-a run.sh --workdir /tmp/toolchain-bisect | |
require "date" | |
require "net/http" | |
require "json" | |
require "tmpdir" | |
def bisect_date_seq(candidates) | |
bad = 0 | |
good = candidates.length - 1 |
swiftc main.swift -emit-module-path main.swiftmodule -emit-executable -enable-private-imports -Xfrontend -enable-implicit-dynamic
./main
-> prints From original bar()
swiftc -emit-library inject.swift -o inject.dylib -I . -Xlinker -undefined -Xlinker suppress -Xlinker -flat_namespace -Xfrontend -disable-access-control
DYLD_INSERT_LIBRARIES=inject.dylib ./main
-> prints From replacement bar()
-Xfrontend -enable-implicit-dynamic
removes you from having to add dynamic
to everything you want to be replacable/// The Jaro-Winkler edit distance between two strings (0 - 1) | |
func editDistance(_ lhs: String, _ rhs: String) -> Double { | |
return 1 - jaroWinklerSimilarity(Array(lhs), Array(rhs)) | |
} | |
/// Jaro-Winkler similarity between two strings (0 - 1) | |
/// https://www.geeksforgeeks.org/jaro-and-jaro-winkler-similarity/ | |
private func jaroWinklerSimilarity(_ s1: [Character], _ s2: [Character]) -> Double { | |
var jaro = jaroSimilarity(s1, s2) |
# IDA (disassembler) and Hex-Rays (decompiler) plugin for Apple AMX | |
# | |
# WIP research. (This was edited to add more info after someone posted it to | |
# Hacker News. Click "Revisions" to see full changes.) | |
# | |
# Copyright (c) 2020 dougallj | |
# Based on Python port of VMX intrinsics plugin: | |
# Copyright (c) 2019 w4kfu - Synacktiv |
protocol P { var pop: String { get } } | |
extension P { | |
var pop: String { "slow" } | |
var pop1: String { pop } | |
} | |
protocol Q: P {} | |
extension Q { var pop: String { "fastQ" } } | |
protocol R: P {} |
/// Classes whose initializers actually create derived classes | |
protocol FactoryInitializable { | |
/// The type of the least-derived class declared to be FactoryInitializable. | |
/// | |
/// - Warning: Do not define this in your FactoryInitializable type! | |
associatedtype FactoryBase: AnyObject, FactoryInitializable = Self | |
// This associatedtype is a trick that captures `Self` at the point where | |
// `FactoryInitializable` enters a class hierarchy; in other contexts, `Self` | |
// refers to the most-derived type. | |
} |
// Run any SwiftUI view as a Mac app. | |
import Cocoa | |
import SwiftUI | |
NSApplication.shared.run { | |
VStack { | |
Text("Hello, World") | |
.padding() | |
.background(Capsule().fill(Color.blue)) |