Rescuing Files From Classic Mac OS...with Swift!

My winter break project was getting the files off an old PowerBook from the 90s (my dad’s old work computer) that I’ve had lying around for a while. (There’s probably not anything of interest there to anyone but our family, but who knows?) I’ve looked at this before, but it’s hard to get a 25-year-old computer to talk to a modern OS.

The Two Faces of Codable/Serde

Swift has a pair of protocols, Encodable and Decodable, which represent generic encoding of a tree structure. These protocols are special in that the compiler can provide a default implementation for them under many circumstances. Similarly, Rust has a project called Serde which likewise is used for roughly the same purpose; Serde’s traits are even more complicated than Codable’s, but have even more powerful code synthesis via Rust’s proc-macros. Both tools are very useful but occasionally frustrating, and I think some of the frustrating areas come from a tension between two competing use cases.

Swift was always going to be part of the OS

Recently on the Swift Forums, someone complained that putting Swift in the OS has only made things worse for developers. My immediate reaction is a snarky “welcome to the world of libraries shipped with the OS”, but that’s not helpful and also doesn’t refute their point. So here’s a blog post that talks about how we got where we did, covering time when I worked on Swift at Apple. But I’m going to have to start a lot earlier to explain the problem…

Older Posts

  1. 2022-04-24 Default Arguments and Label-based Overloading
  2. 2021-12-31 Swift Regrets: Wrap-up
  3. 2021-12-30 Swift History: Assignment Methods
  4. 2021-12-28 Swift Regret: inout Syntax
  5. 2021-12-26 Swift Delight: Optional Conveniences
  6. 2021-12-23 Swift Regret: try?
  7. 2021-12-21 Swift Delight: try
  8. 2021-12-17 Swift Regret: Operator Function Lookup Rules
  9. 2021-12-15 Swift Regret: "Double" rather than "Float64"
  10. 2021-12-10 Swift Delight: Implicit Member Syntax
  11. 2021-12-08 Swift Regret: Weak Vars in Structs
  12. 2021-12-03 Swift Regret: Lazy Vars in Structs
  13. 2021-11-30 Swift Delight: No Unused Results
  14. 2021-11-24 Swift Regret: Open Protocols
  15. 2021-11-21 Swift Regret: Retroactive Conformances
  16. 2021-11-18 Swift Delight: Library Evolution
  17. 2021-11-10 Swift Mangling Regret: Private Discriminators
  18. 2021-11-05 Swift Mangling Regret: The "Old" Mangling
  19. 2021-11-03 Swift Mangling Regret: Library Evolution
  20. 2021-10-29 Swift Delight: #available
  21. 2021-10-22 Swift Regret: Implicitly-Hashable Payloadless Enums
  22. 2021-10-20 Swift Regret: Top-Level Decls in Script Mode
  23. 2021-10-15 Swift Delight: Names for Generic Parameters
  24. 2021-10-13 Swift Regret: Generic Parameters Aren't Members
  25. 2021-10-08 Swift Regret: OpaquePointer
  26. 2021-10-06 Swift Regret: Unannotated C Enums
  27. 2021-10-01 Swift Delight: Value Semantics Collections
  28. 2021-09-29 Swift Delight: guard
  29. 2021-09-24 Swift Regret: Inferred Property Types
  30. 2021-09-22 Swift Regret: Implicit Optional Initialization
  31. 2021-09-17 Swift Regret: Subscript Trailing Closures
  32. 2021-09-15 Swift Regret: Subscript Argument Label Rules
  33. 2021-09-10 Swift Regrets
  34. 2021-09-10 Swift Regret: Unapplied Instance Methods
  35. 2021-09-08 Swift Regret: Bound Methods
  36. 2021-08-29 Swift Regret: Type-based Overloading
  37. 2021-08-25 Swift Regret: AnyObject Dispatch
  38. 2021-08-20 Swift Regret: Labeled Tuple Elements
  39. 2021-08-18 Swift Regret: Tuples and Argument Lists
  40. 2021-08-13 Swift Regret: Sequence
  41. 2021-08-11 Swift Regret: mutating Protocol Methods vs. Classes
  42. 2021-08-06 Swift Regret: NSUInteger
  43. 2021-08-04 Swift Regret: Protocol Syntax
  44. 2020-10-20 The Swift Runtime: Enums
  45. 2020-10-06 The Swift Runtime: Class Metadata Initialization
  46. 2020-09-29 The Swift Runtime: Class Metadata
  47. 2020-09-21 The Swift Runtime: Uniquing Caches
  48. 2020-09-14 The Swift Runtime: Type Metadata
  49. 2020-09-07 The Swift Runtime: Type Layout
  50. 2020-08-31 The Swift Runtime: Heap Objects
  51. 2020-08-26 Objective-Rust
  52. 2020-07-07 Suffusion: Playing with Filesystems
  53. 2020-05-24 ROSE-8 on Mac OS 9
  54. 2020-04-01 Swift on Mac OS 9
  55. 2019-11-01 Leaving Apple
  56. 2018-04-03 "FIXME" Doesn't Always Mean "Fix Me"
  57. 2018-02-26 Many-to-Many Protocols
  58. 2017-09-07 The New Kingdom of Nouns

Possibly Related Tags