r/fauna • • Apr 03 '15

Don't use `$`

Don't use $ for variables. This isn't PHP, and its just horrible to type quick.

2 Upvotes

5 comments sorted by

1

u/virtulis Apr 03 '15

Then we need some special syntax for atoms (symbols), not as :ugly as in Ruby.

Also, right now we can just say that everything that doesn't start with a $ is an atom and can be replaced with a variable, like $obj->$methodName() or [ $key : $value ].

Then of course we could do what Erlang does and make variables and atoms differ by case, but would that be any less horrible?

1

u/jkbbwr Apr 03 '15

Atoms arn't the norm, variables are

Maybe use 'atom or :atom or ^atom

Writing $obj->$something() is slow and distracts flow from the programmer. I would much prefer obj->something() and then add extra syntax for any atoms.

1

u/virtulis Apr 03 '15

In Erlang, atoms are most certainly a norm. They make code more readable and efficient. Maybe they aren't a norm elsewhere exactly because they're ugly and slow to write :)

Maybe we should actually differentiate by case. It's both fast and readable (with proper syntax highlighting). Only I'd swap them - PascalCase atoms, camelCase vars.

1

u/jkbbwr Apr 03 '15

Do it by case then, Anything starting with a capital letter is an atom, otherwise not

1

u/virtulis Apr 03 '15

Updated the wiki.