If You Don't Get Symbols #
Happy Friday, everyone. Now, I want you to know that it’s absolutely okay if you don’t yet understand Ruby symbols. (Which are the :words :with :eyes
.) Kevin Clark has an article introducing symbols to beginners based around a typical data collection scenario: the one where I am being examined by a psycologist. Which is so true.
When I’m not doing tons of drugs (which is rare), then I’m usually being examined by doctors. Fortunately, my life experiences are very rewarding for all of you, especially when they are framed up in a teaching context. Hopefully soon we can have a tutorial on mixins that revolves around my rush to the hospital when I overdosed on injections of crushed dandelion heads. Dude.
kode
Is there a name for your medical condition? ;)
kode
Oh, and, uh, kickass article. thanks for the link.
Danno
The name of why’s affliction? Red Fever.
kode
not rubella, then?
Why's Doc
Why has HyperRubyFocus. There is no cure. Those who have it find it extremely difficult to program in any language other than Ruby. Currently it is spreading rapidly through the programming population by passing code snippets and also via the rails. At the current rate of transmission, Ruby should be the only programming language that anyone uses by 2009. Companies should plan accordingly.
Dude
Dude indeed, dude.
kode
In that case, I guess I have it too. I dread upcoming monday when I will have to start learning java again. Why can’t uni see that ruby is the future? I see it.
Why's Doc
kode: It sounds as though you might have HyperRubyFocus(HRF) as well. You should file an Americans with Disabilities Act (assuming you’re American) lawsuit against your Uni so that they’ll teach Ruby classes as an alternative for those with HRF . Also you should remind them of our scientifically proven data about HRF transmission which shows that everyone will be programming in Ruby by the end of 2009 and no one will be programming in Java (or any other language) by then.
Oh, and just a reminder: You guys need to make sure that Ruby is written in Ruby by the end of 2009 or we’re all hosed.
gormley
_why just jumped out from behind my couch wearing pajamas that sluffed off a generous dermal layer of a curious red gemstone!! Kidding, the poor guy’s probably just hanging out under a ceiling fan.
The good doctor’s analysis is too narrow. What if he added just one of Why’s other blogs to the inquistion, maybe he’s okay.
Why's Doc
gormley: what, you think he’s OK because he posts a lot of pictures that seem to have no meaning or context? Definitely a symptom of HRF ! The patient while hyper-focused on Ruby tries to make sense of his/her world by collecting images that seem to remind them of Ruby or possibly Japan. Just look at those pictures – most of them have red in them! Yes, sometimes it’s only a single pixel, but it’s there; the HRF patient can see it. There’s no mistaking that _why has HRF and that other blog of his only confirms the diagnosis.
Please support the HyperRubyFocus Research Foundation (HRFRF) which seeks to prepare the world for a mono-lingual programming future.
trans
Symbols are immutable, but Strings are not.
Query: What would be the loss is Strings were like Symbols?
Malsky Impersonator
trans: Hey snake boy! You think we want your immutable strings? You can do anything to them. Or are you trying to steal our mutable strings? I think I speak for all the REAL Rubyists here in saying that we want our strings to mutate as much as possible. Out of my cold dead fingers, snake boy!
why
I don’t understand the technical side of it, but I’m starting to feel like mutiny will happen on RedHanded and I will be asked to walk the worldwide plank. I can’t wait to feel the sharks (in the unchartered waters beyond blogs) biting down on my ankle, then to look back up and see all of you ransacking the joint, rolling the text back over itself, tiling malsky across the background, scribbling PYTHON SUCKT YO BLOOD in the margins, and starting those rampant brushfires in absolute divs, triggered by setInterval, use a little 1k js lib, keep it small, keep it efficient. I know you people. I’ve seen the catalogs you get in the mail.
Now leave my doctor alone. He’s always waiving my copay and the guy has the guts to STOP BY MY BLOG . Now that’s my kind of house call.
spinning
_why: the gyrotops you started spinning are now revolving dangerously out of control. The pitchfork-brandishing peasants are either going to burn your server for unleashing Malsky or they’re going to draft you for President – perhaps both.
Be wary of the hardliners in the Malsky wing while also keeping an eye on the appeasers; either way could lead to ruin. Get used to walking the tightrope.
Oh, and the sharks here have chicklet teeth: spearmint. It’ll probably tickle as they bite your ankle releasing a minty fresh aroma that lasts all day.
snake boy
some 1 been smokn the good shneetz lolipop.
MenTaLguY
trans: immutable?
Object#freeze
... ?Or did you mean unique and comparable in O(1)? The reason you wouldn’t want to use symbols (or similar) for everything is that it would bloat the size of the hashtable that necessarily underlies such a thing. Also, symbols, though small, are never freed.
If you have a lot of different unique strings passing through your hands (e.g. lines of input from the user or bytes from a socket), you wouldn’t want to turn them all into symbols; the consequences would be dire.
flori
Yeah:
loop { (1..20).inject(’’) { |s,| s << rand(255) + 1; s }.intern }
e.e.coli
Ha ha ha ha ha ha!
“Words with eyes.”
Bwaaaaaaaa ha ha!
Comments are closed for this entry.