miniblog.

← Back to all posts
24
I'm changing method definition syntax in my language: // old fun (this: Int) inc(): Int { this + 1 } // new method inc(this: Int): Int { this + 1 } The original syntax was inspired by Go, but the new syntax is more grep-friendly and perhaps more readable. Not sure about the verbosity though. Thoughts?

4 Comments

@wilfredh `method` feels too verbose, maybe just leave it as `fun`?.. The ordering does look better though imo (more familiar anyway)
@wilfredh I remember learning Oz and they just used "meth" for method, which I found funny
IMO the : being used both for separating parameter names from types and function return type from the parameters makes it a bit hard to scan the declaration. I personally like arrows for declaring return types