<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/noel-welsh-parametricity-or-comptime-is-bonkers-k7ptxk1d0" -->

---
title: Noel Welsh: Parametricity, or Comptime is Bonkers
description: Parametricity is the property that a generic function's type signature alone can constrain—or even fully determine—its implementation. In Rust, a function `fn...
canonical: https://daily.dev/posts/noel-welsh-parametricity-or-comptime-is-bonkers-k7ptxk1d0
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Noel Welsh: Parametricity, or Comptime is Bonkers | daily.dev
og:description: Parametricity is the property that a generic function's type signature alone can constrain—or even fully determine—its implementation. In Rust, a function `fn...
og:url: https://daily.dev/posts/noel-welsh-parametricity-or-comptime-is-bonkers-k7ptxk1d0
og:image: https://api.daily.dev/og/posts/k7ptXk1d0.png
og:image:alt: Noel Welsh: Parametricity, or Comptime is Bonkers
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Noel Welsh: Parametricity, or Comptime is Bonkers

**[Lobsters](https://daily.dev/sources/lobsters)** · 8 min read · 0 upvotes · 0 comments

## Summary

Parametricity is the property that a generic function's type signature alone can constrain—or even fully determine—its implementation. In Rust, a function `fn mystery<T>(a: T) -> T` can only return its argument; the type system enforces this. Zig's `comptime`, by contrast, allows the function body to inspect and branch on the type at compile time, breaking parametricity entirely. While comptime is genuinely powerful for staging (running arbitrary code at compile time), it conflates staging with generic programming. Languages like Rust and Haskell solve ad hoc polymorphism through traits and type classes, which preserve parametricity while still allowing type-specific behavior. The author argues that comptime is a worse fit for generic programming specifically, because it sacrifices the reasoning guarantees and comprehension benefits that parametricity provides—benefits that compound across an entire codebase.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://noelwelsh.com/posts/comptime-is-bonkers/>

## Similar posts on daily.dev

- [sebastienros/comptime: Comptime brings meta-programming capabilities to C\#, enabling compile-time code generation and evaluation.](https://daily.dev/posts/sebastienros-comptime-comptime-brings-meta-programming-capabilities-to-c-enabling-compile-time-co-l1shyzlio) · Hacker News · 11 upvotes · 0 comments
- [Functional Programmers need to take a look at Zig.](https://daily.dev/posts/functional-programmers-need-to-take-a-look-at-zig--rz9pafogz) · Lobsters · 10 upvotes · 1 comments
- ["Five-Point Haskell": Unconditional Election \(via Parametricity\)](https://daily.dev/posts/five-point-haskell-unconditional-election-via-parametricity--r0wfzd72l) · Planet Haskell · 0 upvotes · 0 comments
- [Type systems are leaky abstractions: the case of Map.take\!/2](https://daily.dev/posts/type-systems-are-leaky-abstractions-the-case-of-map-take-2-5wbmgto0e) · Dashbit · 0 upvotes · 0 comments

---

Tags: [#rust](https://daily.dev/tags/rust), [#zig](https://daily.dev/tags/zig), [#type-systems](https://daily.dev/tags/type-systems)

[View this post on daily.dev](https://daily.dev/posts/noel-welsh-parametricity-or-comptime-is-bonkers-k7ptxk1d0)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Noel Welsh: Parametricity, or Comptime is Bonkers","url":"https://daily.dev/posts/noel-welsh-parametricity-or-comptime-is-bonkers-k7ptxk1d0","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/noel-welsh-parametricity-or-comptime-is-bonkers-k7ptxk1d0"},"datePublished":"2026-03-12T14:08:48.811Z","dateModified":"2026-03-12T14:09:15.966Z","description":"Parametricity is the property that a generic function's type signature alone can constrain—or even fully determine—its implementation. In Rust, a function `fn...","image":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","thumbnailUrl":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/noel-welsh-parametricity-or-comptime-is-bonkers-k7ptxk1d0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"rust,zig,type-systems","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"Noel Welsh: Parametricity, or Comptime is Bonkers"}]}
```

