Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Search For Class:0x00000027b59290 (chrisarcand.com)
91 points by robin_reala on Aug 17, 2016 | hide | past | favorite | 22 comments


> In our case, it should have been the string "display" but called display instead, and by sheer coincidence the word display in any Ruby object is a valid caller.

Wow, that sounds incredibly dangerous... how do you even test for not introducing a bug like that somewhere? I am not so familiar with Ruby, is there a linter or something that can catch these?


It sounds similar to a phenomenon I've seen in Python. You can overwrite the builtins using Python. There's very rarely a good reason to do so, but people often clobber variables like 'type', 'max', 'min' accidentally. I know at least some atom and vim plugins exist to warn you about this.


Perhaps the root of issue here is with the tooling or language, but If I were them I wouldn't feel in control of my own code. And that should be terryfing.


    .col-md-8
       #{@record.name} / #{@record.description}
       - binding.pry
       = check_box_tag(display, true, @record.display, :disabled => true)
       = _('Display in Catalog')
Ruby syntax is terrifying. There is so much going on here I can't even begin to figure out what this code is supposed to do.


This is 90% HAML syntax, and not even very good HAML; the first line (`.col-md-8`) is even worse because of Bootstrap. The only real Ruby is on Line 4. I don't even know what Line 5 is trying to do.

Don't let this poor example turn you off from Ruby, its syntax is amazing. One of my biggest struggles with using other languages is just how ugly the syntax is, even in the best case.


Line 5 looks like it's for i18n. To save on typing and reduce clutter typically "_" is used as an alias for the gettext function.


Ah, that makes sense. Thanks.


Like others have said, that's mostly HAML. HAML syntax is actually succinct and nice once you know what the codes mean.

Basics of it: indentation nests html elements. each line is basically an element or a control structure. = is run this ruby code and display it. - is run this ruby code but don't display it. a period with something after it is shorthand for create a div with that as a class. the fact that it creates nicely formatted html that is automatically closed for you is a bonus. the #{} part is string interpolation that comes from ruby and those items inside that are just ruby objects with functions/attributes on them.

Give ruby a chance and you will likely fall in love with the syntax.


That's less the fault of Ruby and more the fault of HAML. http://haml.info/


Why is the slug "the-search-for-class0x0000001ab51700"? This is mildly upsetting to me.


To see if anyone would notice ;)


The cover up is real!


#DynamicLanguageProblems


What a meaningless existence


It would be easier to read the post if it was in regular English. I have no idea what is being said by the following sequences of characters, that may be words, such as "Meh", "Schweet", and "Mmmmk".

The conclusion of the story is anti-climactic, since from the problem statement itself, it was clear an object was trying to print itself. Then the given line showed the issue exactly, but the author didn't know about "display" in Ruby.

If he used the variable name "Mmmmmk" instead, rather than "display", it would have been more clear.


> I have no idea what is being said by the following sequences of characters, that may be words, such as "Meh", "Schweet", and "Mmmmk".

This is a lie.


Enlighten me, please.

In my native language, meh = girl/daughter, schweet = dessert, mmmk = closest meaning would be "thinking", like "hmmm" in English.


"meh" means "I don't really care". "Schweet" is a way of "cool", in this case sarcastically (notice that when spoken aloud it sounds like "sweet" which is a slang term for cool). "mmmk" means "ok" but in a disinterested fashion.

I'm curious what is your native language where people don't use colloquial terms and only speak "regular"?


Thanks. I did look up "meh" on duckduckgo, and saw something about an "impulse buy" (meh.com), then wondered what is added by using these neologisms. Now I see that the third result for each of these words is from urbandictionary.com, and those definitions comport exactly with yours.

Every written human language has a vernacular versus a written form, typically with a cline between them. English is the closest in correspondence between the two, among the languages I know, but the difference remains.

I do read English every day, but it is much slower for me when people use neologisms that don't have germanic, greek, or roman antecedents, as most English words do. I don't mind learning new vocabulary, especially when it is more precise or apt, as is often the case in math, philosophy, art, or in technical works.

The neologisms this author chose to use are interjections, and I still don't see what power was added to his prose by their use. I suppose they act as shibboleths, signalling his class identity in some way. The entries on urbandictionary.com do give a clue: the origins appear to be "Bill Cosby", "The Simpsons" and "South Park". The OP likes comedy and cartoons? Or marijuana? It's common to hear people talking about getting stoned and watching "The Simpsons" or "South Park" all day. And, that may partially explain his inability to debug his code.

Thanks again.


Where/in what language does meh mean girl or daughter?


Most east indian lanuages, Hindi, etc.


Maybe talking like that is a thing Rails developers do? A cultural tic? I think we should stop beating up on them now that the Rails moment is past.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: