ソース情報
- リポジトリ
- mratsim/tattletale
- ソースの最終更新活動
- 2026年2月13日 17:23
- 検出された SKILL.md の言語
- 英語
- スター
- 40
- フォーク
- 4
インストール方法
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
ソースファイルを確認
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
メニュー
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/mratsim/tattletale --skill nim-type-system-faqコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
SOC 職業分類に基づく
SKILL.md を表示中
| name | nim-type-system-faq |
| description | Nim type system patterns and pitfalls |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"nim-developers","topic":"types"} |
When you define a generic with a union type like T: int|Nullopt_t, Nim requires ALL parameters of that type to be the SAME concrete type:
template handleNegativeIndex[T: int|Nullopt_t](idx: T, axisLen: int): T =
when idx is Nullopt_t:
idx
else:
if idx < 0:
idx + axisLen
else:
idx
This fails if you call handleNegativeIndex(start, len) where start is int and you want to pass nullopt for stop. The compiler complains because int and Nullopt_t are different types, even though both belong to the union.
distinct typeDefine a distinct wrapper type that "unifies" the union:
type OptInt* = distinct int | Nullopt_t
template handleNegativeIndex*[T: int|Nullopt_t](idx: T, axisLen: int): T =
when idx is Nullopt_t:
idx
else:
if idx < 0:
idx + axisLen
else:
idx
func normalizedSlice*(
start, stop: distinct OptInt,
step: OptInt = nullopt, axisLen: int): TorchSlice {.inline.} =
let normStart = handleNegativeIndex(start, axisLen)
let normStop = handleNegativeIndex(stop, axisLen)
torchSlice(normStart, normStop, step)
The distinct keyword creates a new type that:
option[T] from stdlib for explicit optional valuesnullopt singleton for "no value provided"when defined(T) branches for type-specific logic