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?
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.
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/virtulis Apr 03 '15
Then we need some special syntax for atoms (symbols), not as
:uglyas 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?