# Type-C - C11에 variants, generics, pattern matching 추가

Original title: Show HN: Type-C – variants, options, generics and pattern matching for C

> Hacker News story 50602561 · language: ko · submitted 2026-11-22
> Web version: https://zeli.app/ko/story/50602561
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 35 · by [stass](<https://news.ycombinator.com/user?id=stass>) · 💬 6
[original](<https://github.com/stass/type-c>) · [HN discussion](<https://news.ycombinator.com/item?id=50602561>)

## Summary

Type-C는 C11에 부족한 타입 시스템을 더한 언어입니다. variants, exhaustive match, distinct types, generics, result와 try를 제공하며, typec 컴파일러가 Type-C 코드를 읽기 쉬운 C로 변환해 기존 C 컴파일러에 넘깁니다. 런타임이나 GC 없이 C의 선언, 포인터, 헤더를 그대로 유지하면서도 태그된 union의 잘못된 멤버 접근, 빠뜨린 case, id 타입 혼동 같은 C의 흔한 실수를 컴파일 단계에서 차단합니다. 기존 .c 파일 하나를 .tc로 바꾸는 것만으로 점진적 도입이 가능하며, Homebrew로 간단히 설치해 바로 사용할 수 있습니다.

## Key quote

> C11 파일은 이미 Type-C 파일이므로, 프로그램은 파일 하나씩 Type-C를 도입할 수 있습니다.

## HN discussion (6 comments)

### [adsharma](<https://news.ycombinator.com/item?id=50621482>)

> vlang을 쓰면 안 되는 이유라도 있나요?
>
> 저는 python에 같은 걸 하고 싶어서 python 변형의 파서를 작성했습니다.
>
> pypi에 spy-ast로 있습니다.

### [onlyrealcuzzo](<https://news.ycombinator.com/item?id=50621118>)

> \> 물론 Swift, Ocaml, Rust도 있죠
>
> 아마 C++을 가장 먼저 언급해야 할 것 같은데요.

### [stass](<https://news.ycombinator.com/item?id=50603065>)

> 글에 숫자가 좀 부족한 것 같아서 몇 가지 가져왔습니다.
>
> tomlc99의 파서(2천 줄)를 Type-C로 테스트 삼아 다시 작성해봤습니다. 오류 경로에는 result/try/defer를 사용하고 나머지는 그대로 두었으며, 동일한 C 프로그램과 테스트에 링크했습니다.
>
> 약 1500회 실행에 걸쳐 실행당 한 번의 할당 실패를 주입하는 결함 주입을 했을 때: 원래 C는 34회(누수 25회, use-after-free 9회) 문제가 발생했고, 재작성한 버전은 전혀 문제가 없었으며 새니타이저도 깨끗했습니다.
>
> 원래 toml-spec-tests 파일들을 사용했을 때: 원래 버전은 1002개 파일에서 누수가 발생하고 9개에서 크래시가 났지만, 재작성 버전은 둘 다 없었습니다.
>
> 다음은 표현식 평가기의 코드가 어떻게 생겼는지 보여주는 예시입니다:
>
> type expr =
>
> | Num(int value)
>
> | Add(const expr l, const expr r)
>
> | Mul(const expr l, const expr r)
>
> | Div(const expr l, const expr r);
>
> static result(int, eval_error)
>
> eval(const expr *e)
>
> {
>
> int d;
>
> match (*e) {
>
> case Num(value):
>
> return (Ok(value));
>
> case Add(l, r):
>
> return (fit((long long)try eval(l) + try eval(r)));
>
> …
>
> 질문이 있으시면 언제든 답변드리겠습니다!

---

## Cite

- Page: https://zeli.app/ko/story/50602561
- Date: 2026-11-22
- Source: github.com (https://github.com/stass/type-c)
- Hacker News: https://news.ycombinator.com/item?id=50602561

## Other languages

- en: https://zeli.app/story/50602561 · markdown: https://zeli.app/story/50602561.md
- zh: https://zeli.app/zh/story/50602561 · markdown: https://zeli.app/zh/story/50602561.md
- ja: https://zeli.app/ja/story/50602561 · markdown: https://zeli.app/ja/story/50602561.md
- de: https://zeli.app/de/story/50602561 · markdown: https://zeli.app/de/story/50602561.md
- es: https://zeli.app/es/story/50602561 · markdown: https://zeli.app/es/story/50602561.md
- ru: https://zeli.app/ru/story/50602561 · markdown: https://zeli.app/ru/story/50602561.md
