leahneukirchen / styleguide

442 stars 103 forks source link

" * Never use smalltalk: symbols." #2

Open ghost opened 9 years ago

ghost commented 9 years ago

Hey chris2,

Do you think you could clarify on that part?

I am unsure what smalltalk: symbols are and perhaps other people may also not know.

Thanks!

leahneukirchen commented 9 years ago

"Robert A. Heiler" notifications@github.com writes:

Hey chris2,

Do you think you could clarify on that part?

I am unsure what smalltalk: symbols are and perhaps other people may also not know.

Well, these new-style symbol hashes in Ruby 2:

>> {foo: 42, bar: 23}
=> {:foo=>42, :bar=>23}

>> p foo: 42, bar: 23
{:foo=>42, :bar=>23}

I think they are harder to parse because that it's a symbol is only clear at the final :.

Christian Neukirchen chneukirchen@gmail.com http://chneukirchen.org