On 5 Aug 2014, at 5:46 pm, Marky Mark <[email protected]> wrote:
> ...It made me go back and look at C++'s switch statement (see a just-prior 
> posting) and feel frustrated that C++ doesn't support such flexibility.

The Ruby case statement is just a fancy syntax for if… else if…else if… else.
C applies Occam’s razor, not multiplying features needlessly. On the other hand,
its switch statement does something that is well-supported by the hardware, but
unavailable in Ruby; namely, allowing the compiler to decide when to use jump
tables to get super-fast selection of cases.

Feel frustrated all you like, but C is *more* functional than Ruby in this 
situation,
not less.

Clifford Heath.

> (I mean not even support the generic object.equals syntax, never mind a 
> closure.) That's the kind of thing that highlights why one might bother with 
> Ruby at all. If you don't get the cleverness presented to you, you might 
> never find out about it.
> 
> On Tuesday, August 5, 2014 5:22:31 PM UTC+10, Dan Harper wrote:
> On 5 Aug 2014, at 4:24 pm, Tim Moore <[email protected]> wrote:
>> One thing that hasn't been mentioned yet, and which unfortunately I couldn't 
>> really address in the talk without a long tangent, is why would you want to 
>> write code like this in the first place? Is a proc in a case statement 
>> anything but a useless, overly-clever bit of language esoterica?
> 
> I had the same thought. After some musing, I came to the conclusion that you 
> should opt for simpler code using simple concepts and cop the penalty of it 
> being more verbose. Not everyone will agree I’m sure, and that’s cool.
> 
> The advantages of having simpler code using simple concepts is that your code 
> is now more easily understood by other developers with a lower level of Ruby 
> knowledge.  This is the same reason I try to not perform Ruby gymnastics in 
> tests. If I do decide to use some more complex code, I use comments to 
> explain what I’m doing.
> 
> This was probably more important back in the day when hardly anyone used 
> Ruby, but I still follow it.
> 
> If you’re just consuming gems (not authoring them) and say, coding in Rails, 
> you’ll rarely have a need to use Proc or similar concepts. So when you’re 
> learning, I’d say don’t bother with Proc and fancy Ruby concepts. Learn other 
> things that will get you more productive at a faster rate.
> 
> Dan
> 
> 
> Dan Harper
> [email protected]
> Mobile:  0414 344 233
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby or Rails Oceania" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rails-oceania.
> For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to