apricot-lang / apricot

Clojure-like Lisp on Rubinius
94 stars 7 forks source link

Character Literal Syntax #9

Closed causal-agent closed 12 years ago

causal-agent commented 12 years ago

Both Clojure (\a) and Ruby (?a) have character literal syntax. In Clojure, this is actually useful because it creates a java.lang.Character. In Ruby, however, this syntax seems to be useless other than saving one character of source code, since Ruby has no character class and it simply creates a string with one character in it.

It seems useless to me, but it would be easy to implement and might make someone happy. Discuss.

solson commented 12 years ago

In Clojure, it really has a purpose. I have never understood why Ruby has ?a syntax, so I don't think Apricot should have anything like it either.

causal-agent commented 12 years ago

It's for the code golf!

solson commented 12 years ago

I do remember something of ?a syntax actually. In Ruby 1.8 ?a would return 97, but in Ruby 1.9 it returns "a".

solson commented 12 years ago

And Lisp code golf sounds pretty scary.

solson commented 12 years ago

Since Ruby doesn't have a Character class, I'm going to close this.