[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

how do I contribute to Ruby?

Giles Bowkett

11/22/2006 10:28:00 PM

check this out, this is the whiniest change ever, but what I want is
this to work:

irb(main):001:0> "".is_a? String
=> true
irb(main):002:0> [].is_an? Array
NoMethodError: undefined method `is_an?' for []:Array
from (irb):2


I just HATE writing "is_a? Array" because it's grammatically incorrect.

I realize this is incredibly silly and anal, but the thing is, all you
have to do is one simple alias command and you're good to go.

so -- how do I contribute to Ruby itself?

--
Giles Bowkett
http://www.gilesg...

15 Answers

Gabriele Marrone

11/22/2006 10:38:00 PM

0


On 22/nov/06, at 23:28, Giles Bowkett wrote:

> I just HATE writing "is_a? Array" because it's grammatically
> incorrect.

What about String#include? isntead of includes? :P

> I realize this is incredibly silly and anal, but the thing is, all you
> have to do is one simple alias command and you're good to go.
>
> so -- how do I contribute to Ruby itself?

Do you mean how to add functionalities to core classes?

class Object
alias :is_an? :is_a?
end

"is_an?" is now an alias to "is_a?"

--
Gabriele Marrone



Giles Bowkett

11/22/2006 10:43:00 PM

0

No, I mean where to submit that change, having made it. Although I
suppose if you go ahead and submit it, you get all the glory (Ruby
contributor! wow! that must look good on a resume).

I mean it is a pretty obvious change.

String#include? doesn't bother me for some reason. I don't know why.

On 11/22/06, Gabriele Marrone <gabriele.marrone@gmail.com> wrote:
>
> On 22/nov/06, at 23:28, Giles Bowkett wrote:
>
> > I just HATE writing "is_a? Array" because it's grammatically
> > incorrect.
>
> What about String#include? isntead of includes? :P
>
> > I realize this is incredibly silly and anal, but the thing is, all you
> > have to do is one simple alias command and you're good to go.
> >
> > so -- how do I contribute to Ruby itself?
>
> Do you mean how to add functionalities to core classes?
>
> class Object
> alias :is_an? :is_a?
> end
>
> "is_an?" is now an alias to "is_a?"
>
> --
> Gabriele Marrone
>
>
>
>


--
Giles Bowkett
http://www.gilesg...

Paul Lutus

11/22/2006 11:29:00 PM

0

Giles Bowkett wrote:

> No, I mean where to submit that change, having made it. Although I
> suppose if you go ahead and submit it, you get all the glory (Ruby
> contributor! wow! that must look good on a resume).

I know you are saying this in fun, but this motivation is surely the biggest
single contributor to cruft. Over the years I've watched people build
drivers aimed squarely at the Linux kernel, even if the driver is perfectly
happy and better off in user-space, just to be able to say they contributed
something to the Linux kernel.

> I mean it is a pretty obvious change.

And an end user can make it easily, so there's no point in making it part of
the language.

Next we'll have a method called "less" for when dealing with a continuous
changing quantity:

def less(q)
return 0.9 * q
end

.... and "fewer" when dealing with enumerable sets of items:

def fewer(a)
a.shift
return a
end

.... and an error message if someone uses "less" when they should have used
"fewer." :)

The less/fewer distinction happens to be one of my perennial grammar gripes,
but I don't think it's necessary or desirable to put it into a computer
language.

One night on the news Bush said there was going to be less soldiers in Iraq,
and I immediately imagined a group of physically short soldiers boarding a
troop transport.

--
Paul Lutus
http://www.ara...

Joel VanderWerf

11/22/2006 11:30:00 PM

0

Giles Bowkett wrote:
> I just HATE writing "is_a? Array" because it's grammatically incorrect.

[].kind_of? Array

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Jano Svitok

11/22/2006 11:57:00 PM

0

On 11/22/06, Giles Bowkett <gilesb@gmail.com> wrote:
> No, I mean where to submit that change, having made it. Although I

There is a tracker for ruby at rubyforge, and there is a ruby-core
mailing list. See
http://www.ruby-lang.org/en/community/ruby-core/#pat...

wmwilson01

11/23/2006 4:00:00 AM

0

Giles Bowkett wrote:
> check this out, this is the whiniest change ever, but what I want is
> this to work:
>
> irb(main):001:0> "".is_a? String
> => true
> irb(main):002:0> [].is_an? Array
> NoMethodError: undefined method `is_an?' for []:Array
> from (irb):2
>
>
> I just HATE writing "is_a? Array" because it's grammatically incorrect.
>
> I realize this is incredibly silly and anal, but the thing is, all you
> have to do is one simple alias command and you're good to go.
>
> so -- how do I contribute to Ruby itself?

Well, unlike a lot of languages, in Ruby you can modify all sorts of
built-ins. I don't personally believe that a case such as this
warrants it though, and often in Ruby it's better to use respond_to?
(duck typing) depending on the situation of course.

class Array
def is_an?(klass)
return is_a?(klass)
end
end

[].is_an? Array #=> true

--
Posted via http://www.ruby-....

David Vallner

11/23/2006 12:10:00 PM

0

Giles Bowkett wrote:
> No, I mean where to submit that change, having made it. Although I
> suppose if you go ahead and submit it, you get all the glory (Ruby
> contributor! wow! that must look good on a resume).
>

Dear LORD in heavens.

Makes me wonder if HR people do investigate whether "contributor"
actually means "commit whore".

On a less flamey note, that change is just too silly to be in the core
library, I don't need -yet- another "foo is a synonym for bar" in the
documentation.

David Vallner

dblack

11/23/2006 12:28:00 PM

0

Giles Bowkett

11/24/2006 7:45:00 PM

0

On 11/23/06, David Vallner <david@vallner.net> wrote:
> Giles Bowkett wrote:
> > No, I mean where to submit that change, having made it. Although I
> > suppose if you go ahead and submit it, you get all the glory (Ruby
> > contributor! wow! that must look good on a resume).
>
> Dear LORD in heavens.
>
> Makes me wonder if HR people do investigate whether "contributor"
> actually means "commit whore".

The type of companies that hire through HR people, no, they don't
check. Maybe Google's HR does, but even there I doubt it. Hiring
through HR people is a guarantee for questions like, "We need five
years of Rails experience, do you have that?"

> On a less flamey note, that change is just too silly to be in the core
> library, I don't need -yet- another "foo is a synonym for bar" in the
> documentation.

I did say it was the whiniest change ever. It might be too silly for
the core library, hell, it's probably too silly for its shirt -- so
silly it hurts -- but using "a" where I should use "an" just sets off
my inner compulsive librarian.

--
Giles Bowkett
http://www.gilesg...

Giles Bowkett

11/24/2006 7:48:00 PM

0

> Well, unlike a lot of languages, in Ruby you can modify all sorts of
> built-ins. I don't personally believe that a case such as this
> warrants it though, and often in Ruby it's better to use respond_to?
> (duck typing) depending on the situation of course.
>
> class Array
> def is_an?(klass)
> return is_a?(klass)
> end
> end
>
> [].is_an? Array #=> true

Just as an aside, to implement this, I would much rather monkeypatch
Object than Array. Otherwise it just happens again the next time I
have a class which begins with a vowel.

--
Giles Bowkett
http://www.gilesg...