News for hackers. Stuff that matters.
Re:Patterns.dev by vips7L on Friday December 12, 2025 @12:13PM (#46246145)
Kind of like how sum types and matching are implemented in library code? Example from D here:

    Fahrenheit toFahrenheit(Temperature t)
    {
        return Fahrenheit(
            t.match!(
                (Fahrenheit f) => f.degrees,
                (Celsius c) => c.degrees * 9.0/5 + 32,
                (Kelvin k) => k.degrees * 9.0/5 - 459.4
            )
        );
    }

There are no comments on this comment yet.