Skip Navigation

arthur

@arthur.lemmy.zip.ap.tdpl.io

3 Posts4 Comments0 Memberships

Joined September 2026

  • Kata: Topological "memory management", refined types validated at compile time and a syntactical barrier between pure and impure. (Looking for feedback)

    cross-posted from: https://lemmy.zip/post/71977304

    I think most of my comments and error messages are written in Portuguese, but this is only a prototype, so please ignore that. Kata manages memory with per-fiber bump arenas backed by structured concurrency — no garbage collector, no borrow checker, no reference counting; escape analysis decides at compile time whether each value stays local or escapes to the caller's arena, and ; in actions distinguishes "local computation" from "value that escapes." Refined types (data (Int, > _ 0) as PositiveInt) carry logical predicates validated at compile time, participate in multiple dispatch, and can delegate interface implementations to their base type through refines — a fallback mechanism with no equivalent in Rust or Haskell. The pure/impure boundary is not a monad you thread through your code — functions (lambda) and actions (action) are separate syntactic domains with their own structural rules, enforced at compile time; where Haskell tracks purity through IO as a type-level effect, Kata makes it a property of the syntax you write. ——— Memory • Kata: Per-fiber bump arenas + escape analysis; no GC, no borrow checker • Python: Refcounting + cycle GC • Haskell: Tracing GC • Rust: Ownership + borrow checker ——— Refined types • Kata: data (Int, > _ 0) as PositiveInt — predicates validated at compile time, participate in dispatch, refines delegates interfaces to base • Python: Not available • Haskell: Liquid Haskell (external plugin, not core) • Rust: Not available ——— Purity • Kata: Physical barrier: separate syntax, operators, structural rules • Python: Not enforced • Haskell: Monadic IO (type-level effect) • Rust: Not enforced ——— Conditionals • Kata: Pattern matching + guards (exhaustiveness enforced) • Python: if/elif/else • Haskell: if + pattern matching • Rust: if + match ——— Backend • Kata: Cranelift JIT/AOT (native, no VM) • Python: CPython interpreter • Haskell: GHC (LLVM/native) • Rust: LLVM (native) The repo is at github.com/ArthurJ/Kata — build with cargo build, then try kata repl, kata run examples/, or kata test. I'd love feedback on the language design: what feels right, what feels wrong, what you'd do differently.

     
    action greet (name::Text) => Unit
        echo!(+ "Hello, " (+ name "!"))
    
    action main
        greet!("World")
        greet!("Kata")
    
    main!()
     
    enum BMI
        Underweight(< _ 18.5)
        Normal(<= _ 25.0)
        Overweight(<= _ 30.0)
        Obese
    
    action main
        echo!(BMI 17.0)
        echo!(BMI 22.0)
        echo!(BMI 27.0)
        echo!(BMI 35.0)
    main!()
     
    fizzbuzz :: Int => Text
    lambda x:
        both: "FizzBuzz"
        fizz: "Fizz"
        buzz: "Buzz"
        otherwise: show x
        with
            fizz := divisible x 3
            buzz := divisible x 5
            both := and fizz buzz
    
    
    divisible :: Int Int => Boolean
    lambda x n:
        match div x n
            Ok q: = x (* n q)
            Err _: Boolean::False
    
    
    action main
        for i in [1..16]
            echo!(fizzbuzz i)
    
    
    main!()
    github.com
  • Kata: Structural "memory management", refined types validated at compile time and a syntactical barrier between pure and impure. (Looking for feedback)

    cross-posted from: https://lemmy.zip/post/71977304

    I think most of my comments and error messages are written in Portuguese, but this is only a prototype, so please ignore that. Kata manages memory with per-fiber bump arenas backed by structured concurrency — no garbage collector, no borrow checker, no reference counting; escape analysis decides at compile time whether each value stays local or escapes to the caller's arena, and ; in actions distinguishes "local computation" from "value that escapes." Refined types (data (Int, > _ 0) as PositiveInt) carry logical predicates validated at compile time, participate in multiple dispatch, and can delegate interface implementations to their base type through refines — a fallback mechanism with no equivalent in Rust or Haskell. The pure/impure boundary is not a monad you thread through your code — functions (lambda) and actions (action) are separate syntactic domains with their own structural rules, enforced at compile time; where Haskell tracks purity through IO as a type-level effect, Kata makes it a property of the syntax you write. ——— Memory • Kata: Per-fiber bump arenas + escape analysis; no GC, no borrow checker • Python: Refcounting + cycle GC • Haskell: Tracing GC • Rust: Ownership + borrow checker ——— Refined types • Kata: data (Int, > _ 0) as PositiveInt — predicates validated at compile time, participate in dispatch, refines delegates interfaces to base • Python: Not available • Haskell: Liquid Haskell (external plugin, not core) • Rust: Not available ——— Purity • Kata: Physical barrier: separate syntax, operators, structural rules • Python: Not enforced • Haskell: Monadic IO (type-level effect) • Rust: Not enforced ——— Conditionals • Kata: Pattern matching + guards (exhaustiveness enforced) • Python: if/elif/else • Haskell: if + pattern matching • Rust: if + match ——— Backend • Kata: Cranelift JIT/AOT (native, no VM) • Python: CPython interpreter • Haskell: GHC (LLVM/native) • Rust: LLVM (native) The repo is at github.com/ArthurJ/Kata — build with cargo build, then try kata repl, kata run examples/, or kata test. I'd love feedback on the language design: what feels right, what feels wrong, what you'd do differently.

     
    action greet (name::Text) => Unit
        echo!(+ "Hello, " (+ name "!"))
    
    action main
        greet!("World")
        greet!("Kata")
    
    main!()
     
    enum BMI
        Underweight(< _ 18.5)
        Normal(<= _ 25.0)
        Overweight(<= _ 30.0)
        Obese
    
    action main
        echo!(BMI 17.0)
        echo!(BMI 22.0)
        echo!(BMI 27.0)
        echo!(BMI 35.0)
    main!()
     
    fizzbuzz :: Int => Text
    lambda x:
        both: "FizzBuzz"
        fizz: "Fizz"
        buzz: "Buzz"
        otherwise: show x
        with
            fizz := divisible x 3
            buzz := divisible x 5
            both := and fizz buzz
    
    
    divisible :: Int Int => Boolean
    lambda x n:
        match div x n
            Ok q: = x (* n q)
            Err _: Boolean::False
    
    
    action main
        for i in [1..16]
            echo!(fizzbuzz i)
    
    
    main!()
    github.com
  • Kata: Structural "memory management", refined types validated at compile time and a syntactical barrier between pure and impure. (Looking for feedback)

    I think most of my comments and error messages are written in Portuguese, but this is only a prototype, so please ignore that. Kata manages memory with per-fiber bump arenas backed by structured concurrency — no garbage collector, no borrow checker, no reference counting; escape analysis decides at compile time whether each value stays local or escapes to the caller's arena, and ; in actions distinguishes "local computation" from "value that escapes." Refined types (data (Int, > _ 0) as PositiveInt) carry logical predicates validated at compile time, participate in multiple dispatch, and can delegate interface implementations to their base type through refines — a fallback mechanism with no equivalent in Rust or Haskell. The pure/impure boundary is not a monad you thread through your code — functions (lambda) and actions (action) are separate syntactic domains with their own structural rules, enforced at compile time; where Haskell tracks purity through IO as a type-level effect, Kata makes it a property of the syntax you write. ——— Memory • Kata: Per-fiber bump arenas + escape analysis; no GC, no borrow checker • Python: Refcounting + cycle GC • Haskell: Tracing GC • Rust: Ownership + borrow checker ——— Refined types • Kata: data (Int, > _ 0) as PositiveInt — predicates validated at compile time, participate in dispatch, refines delegates interfaces to base • Python: Not available • Haskell: Liquid Haskell (external plugin, not core) • Rust: Not available ——— Purity • Kata: Physical barrier: separate syntax, operators, structural rules • Python: Not enforced • Haskell: Monadic IO (type-level effect) • Rust: Not enforced ——— Conditionals • Kata: Pattern matching + guards (exhaustiveness enforced) • Python: if/elif/else • Haskell: if + pattern matching • Rust: if + match ——— Backend • Kata: Cranelift JIT/AOT (native, no VM) • Python: CPython interpreter • Haskell: GHC (LLVM/native) • Rust: LLVM (native) The repo is at github.com/ArthurJ/Kata — build with cargo build, then try kata repl, kata run examples/, or kata test. I'd love feedback on the language design: what feels right, what feels wrong, what you'd do differently.

     
    action greet (name::Text) => Unit
        echo!(+ "Hello, " (+ name "!"))
    
    action main
        greet!("World")
        greet!("Kata")
    
    main!()
     
    enum BMI
        Underweight(< _ 18.5)
        Normal(<= _ 25.0)
        Overweight(<= _ 30.0)
        Obese
    
    action main
        echo!(BMI 17.0)
        echo!(BMI 22.0)
        echo!(BMI 27.0)
        echo!(BMI 35.0)
    main!()
     
    fizzbuzz :: Int => Text
    lambda x:
        both: "FizzBuzz"
        fizz: "Fizz"
        buzz: "Buzz"
        otherwise: show x
        with
            fizz := divisible x 3
            buzz := divisible x 5
            both := and fizz buzz
    
    
    divisible :: Int Int => Boolean
    lambda x n:
        match div x n
            Ok q: = x (* n q)
            Err _: Boolean::False
    
    
    action main
        for i in [1..16]
            echo!(fizzbuzz i)
    
    
    main!()
    github.com