Skip to content
Tech News
← Back to articles

Lisette a little language inspired by Rust that compiles to Go

read original more articles
Why This Matters

This article introduces Lisette, a language inspired by Rust that compiles to Go, highlighting its unique features and current limitations. It emphasizes the importance of understanding how Lisette handles pattern matching, null values, error propagation, and API visibility, which are crucial for developers considering its adoption. The insights help both industry professionals and consumers evaluate Lisette's potential for safer and more expressive programming in the Go ecosystem.

Key Takeaways

πŸ”΄ match is not exhaustive ╭─[example.lis:4:3] 2 β”‚ enum Severity { Low, High, Critical } 3 β”‚ fn should_alert(s: Severity) -> bool { 4 β”‚ match s { Β· ───┬─── Β· ╰── not all patterns covered 5 β”‚ Severity.Low => false, 6 β”‚ Severity.High => true, 7 β”‚ } ╰──── help: Handle the missing case Severity.Critical , e.g. Severity.Critical => { ... }

πŸ”΄ nil is not supported ╭─[users.lis:3:12] 1 β”‚ fn find(name: string) -> Option<User> { 2 β”‚ if name.is_empty() { 3 β”‚ return nil Β· ─┬─ Β· ╰── does not exist 4 β”‚ } 5 β”‚ db.lookup(name) 6 β”‚ } ╰──── help: Absence is encoded with Option<T> in Lisette. Use None to represent absent values

🟑 Result is silently discarded ╭─[files.lis:7:3] 5 β”‚ fn cleanup() -> Result<(), error> { 6 β”‚ os.RemoveAll("cache_dir")? 7 β”‚ os.Remove("temp.txt") Β· ──────────┬────────── Β· ╰── failure will go unnoticed 8 β”‚ } ╰──── help: Handle this Result with ? or match , or explicitly discard it with let _ = ...

🟑 Private type Config in public API ╭─[config.lis:6:24] 5 β”‚ struct Config { host: string, port: int } 6 β”‚ pub fn new_config() -> Config { Β· ───┬── Β· ╰── private 7 β”‚ Config { host: "localhost", port: 8080 } ╰──── help: Config is private but exposed by new_config , which is public. Add pub to the private type or remove it from the public API

πŸ”΄ Immutable argument passed to mut parameter ╭─[sort.lis:5:13] 4 β”‚ let nums = [3, 1, 2] 5 β”‚ sort.Ints(nums) Β· ──┬─ Β· ╰── expected mutable, found immutable 6 β”‚ } ╰──── help: Bindings in Lisette are immutable by default. Use let mut nums = ... to allow mutation