evincarofautumn / kitten

A statically typed concatenative systems programming language.
http://kittenlang.org/
Other
1.1k stars 42 forks source link

Rename “def” to “define”. #134

Closed evincarofautumn closed 10 years ago

evincarofautumn commented 10 years ago

This is part of a general effort to make Kitten’s syntax more ergonomic and consistent. Anyone want to voice objections? It’s longer, but I also don’t see a reason to have gratuitously abbreviated keywords like Rust, and the only language that Sam Developer has seen with def is Python, which could be a false friend.

strager commented 10 years ago

I like it.

On Fri, Oct 10, 2014 at 7:36 PM, Jon Purdy notifications@github.com wrote:

This is part of a general effort to make Kitten’s syntax more ergonomic and consistent. Anyone want to voice objections? It’s longer, but I also don’t see a reason to have gratuitously abbreviated keywords like Rust, and the only language that Sam Developer has seen with def is Python, which

could be a false friend.

You can merge this Pull Request by running

git pull https://github.com/evincarofautumn/kitten def-define

Or view, comment on, or merge it at:

https://github.com/evincarofautumn/kitten/pull/134 Commit Summary

  • Rename 'def' to 'define'.

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/evincarofautumn/kitten/pull/134.

brendanzab commented 10 years ago

The counter argument is for Huffman coding - more frequently used things should be shorter, and less common things longer. This is the direction that Rust has been moving in. def is used so much that it seems sensible (depending on your point of view) to have it short.

evincarofautumn commented 10 years ago

For a shorter keyword, I would accept something like let:

let dup @a (a -> a a):
  -> x; x x

let swap @a b (a b -> b a):
  -> x y; y x

A mnemonic operator like Joy’s == (Unicode , “identical to”) would be okay. It would let the name always be at the beginning of a line, which is a style some people like in C. Presumably type term would become valid syntax for denoting that term must be an instance of type, which is something we need anyhow.

dup == @a (a -> a a):
  -> x; x x

swap == @a b (a b -> b a):
  -> x y; y x
strager commented 10 years ago

Any reason you can't drop the token entirely?

+ (Int -> Int): ...
brendanzab commented 10 years ago

By the way, feel free to ignore me – I'm not very invested in Kitten right now, so I'm just offering an alternative perspective.

evincarofautumn commented 10 years ago

Any reason you can't drop the token entirely?

No, but I would like some kind of explicit token to avoid ambiguity, and to be able to make it non-special in the future—e.g., desugaring define name body to name body define__.

I'm just offering an alternative perspective.

I appreciate all the input I can get. :)