Repository navigation
把 'Optional 解码目标迁到 Option - #8
Merged
Merged
Conversation
calcit 0.32 schedules the legacy `Optional<T>` for removal (calcit#2233). The 23 `'Optional` decode targets here followed one shape: `.unwrap-or (get m :k) nil` erased an Option back to nil, then `decode-map-as … (:: 'Optional T)` and often `nil->option` turned it back into an Option. Store slots that may hold nil are now read with `.and-then (get m :k) present-option` and decoded once as `(:: 'Option T)`, so the result is already an Option. The renderer view keeps `selected-channel`, `selected-history`, `selected-storage`, `workspace-entry` and `storage-error` as Options and matches on them; `selected-channel?` and `storage-kind?` replace the nil checks. Ack messages pass `Option :none` / `Option :some message` directly. `present-option` is a local helper because strict checking rejects passing `nil->option` (still `Optional`-typed in 0.30.1) as a callback. No `'Optional` or `nil->option` remains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019bPdumddHcfQCCCVRuVyXS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Jon · project thread
改动
calcit 0.32 计划删除旧的
Optional<T>(calcit-lang/calcit#2233,calcit 0.33.0 里程碑)。本仓库有 23 处'Optional解码目标,写法都一样:先用.unwrap-or (get m :k) nil把 Option 退回 nil,再decode-map-as … (:: 'Optional T),很多地方还要接一次nil->option变回 Option。.and-then (get m :k) present-option读取,并直接按(:: 'Option T)解码一次,结果已经是 Option。selected-channel、selected-history、selected-storage、workspace-entry和storage-error保持为 Option 并用match处理。新增selected-channel?和storage-kind?,替代原来的 nil 判断。Option :none或Option :some message。present-option放在app.comp.container作为本地 helper,并加进app.main和app.updater的:refer。这样做是因为 strict 检查不允许把nil->option(0.30.1 里参数仍是Optional类型)当作.and-then的回调。改完后
calcit.cirru中不再有'Optional和nil->option。本地验证
按 workflow 里的步骤本地跑过:
caps --strict --ci、caps verify --toolchain、calcit edit format后无 diff、--check-only和--check-only --all-defs、fix --workflow strict --verify(status passed,diagnostics 为空)、analyze weak-types --only deprecated-call(calls 为 0)。Generated by Claude Code