[AIT-124] Sketch of how user-specified types might work in Swift#129
Conversation
Not sure of best approach here yet
Briefly explains what the directory is for (proving we could later layer shape support on top of the unshaped path-based API), names the files, points readers who only want to read one file at Example/Shape.swift, and notes that the proof is still incomplete: the example generated code isn't fully filled in and no real codegen has been demonstrated yet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This builds on top of #128. Was never finished due to shifting priorities.
Some notes by Claude:
A standalone experiment to convince ourselves that, if we later wanted to, we could layer support for user-specified object shapes (the Swift analogue of ably-js's
channel.object.get<MyChannelObject>()) on top of the unshaped path-based API proposed in #128, without breaking it.Everything new lives under
Sources/AblyLiveObjects/Public/UserDefinedTypeSupport/. TheREADME.mdinside is the reader's guide. If you only want to read one file, readExample/Shape.swift— it shows what the API would ideally look like to a user.What this is / isn't
Example/GeneratedCode.swiftstill has unfilled pieces (PathObjectKnownEntry.init?(key:pathObject:)isfatalError("TODO")).@LiveMapShapemacro has been written — the "generated" code is hand-written.So this directory shows that the shape of the public API is expressible in Swift and that example call sites compile, but the codegen-and-runtime-glue layer underneath remains unproven.
Further notes
A couple of notes that I wrote down at the time, which explain my thinking on this (basically, I was inspired by Swift's
KeyPath):Related tickets