The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Less Blockage

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
Less Blockage Posted: Nov 6, 2005 11:38 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: Less Blockage
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
As I'm sitting here, working on my own little suite of tests and benchmarks for the Array class, I've decided that I hate all methods that support blocks for the sole purpose of avoiding a call to Enumerable#map, and that's most of them. Actually, I decided that a while ago, but I thought I'd share it with you all. Because you care, right?

The main issue is that it's more work on the C side of the house, where you have to write (and maintain) code logic based on the various permutations of arguments to make sure the user does the right thing: Was a single argument passed? Ok, if a single argument was passed but not a block do X, but if a single argument was passed *and* a block was passed do Y. If a block was passed but not an argument do Z. Oh, and two arguments is acceptable, but then a block shouldn't be allowed. Oh, and BLAH, BLAH, fucking BLAH.

I've also decided that I hate Enumerable#inject. It's become the Ruby equivalent of Perl Golf, but instead of trying to find the shortest solution to a problem, people try to find the most clever use of inject to solve the problem.

Read: Less Blockage

Topic: PLANET ARGON Core Team Grows +1 Previous Topic   Next Topic Topic: Usable Ruby folding for Vim

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use