danilopedraza / komodo

The Komodo programming language code repository
https://komodo-lang.org/
GNU General Public License v3.0
7 stars 0 forks source link

`case` syntax #72

Closed danilopedraza closed 1 month ago

danilopedraza commented 2 months ago

I don't like to write patterns with separate let expressions anymore. Together, they can be checked to be correct, but the syntax makes more bad code possible than if it wasn't available. I'm thinking of a new syntax, inspired by Elixir:

let last(list) := case list do
    [val] => val
    [_|tail] => last(tail)

I'm thinking of implementing this to replace the repeated let expressions for a single function.

danilopedraza commented 1 month ago

This is now implemented. I changed my mind on the let expressions. Everyone can write bad code with any syntax. I need something else to promote good code.