memesearch
Rust Devs Explain Infinite Types

Rust Devs Explain Infinite Types

Download Find similar pictures
Text on the meme
it's basically doable with a type level fixed point combinator (to write the infinite type fn() -> fn() -> fn() -> fn() -> ... as Fix<|A| fn() -> A>; the type-level function from A to fn() -> A is a higher-kinded type, and I think there's ways to encode HKT's in terms of GATs. trait TypeFn { type Output<A>; } struct Fix<F: TypeFn> (<F as TypeFn>::Output<Fix<F>>>; fn FnArrow impl TypeFn for FnArrow { type Output<A> = fn() -> A; } fn retself() -> Fix<FnArrow> { Fix(retself as fn() -> Fix<FnArrow>) } fn main() { println!("{:x}", retself as usize); println!("{:x}", retself().0 as usize); println!("{:x}", retself().0().0 as usize); println!("{:x}", retself().0().0().0 as usize); println!("{:x}", retself().0().0().0().0 as usize); } rust devs be like ^
What it means

A Discord screenshot shows someone explaining an extremely abstract Rust type-level fixed-point combinator, followed by dense Rust code that recursively prints function pointers. The joke is that Rust developers casually discuss higher-kinded types and GATs before producing incomprehensible type machinery, so it is used as a reaction to overcomplicated Rust code or intensely technical programming discourse.

Objects
Tags
Source
Type
image
Size
800×537 · 60.8 KiB
Mood
саркастичный, абсурдный
Language
en
Added