[ruby-core:32672] Re: [Ruby 1.9-Feature#3845][Open] "in" infix operator

From: Piotr Szotkowski <chastell@...>
Date: 2010-10-02 12:41:26 UTC
List: ruby-core #32672
Roger Pack:

> The object oriented way would also be acceptable
> to me, I think, so one or the other is fine.

> if a.in? [1,2,3]
>     p ' it is in 1,2,3'
> end

This was proposed previously:

class Object
  def in? enum
    enum.include? self
  end
end

IIRC the resolution was that an object being a part of a collection is
not a property of the object but rather a property of the collection
=E2=80=93 hence the existence of Enumerable#include? and the inexistence of
Object#in?

=E2=80=94 Piotr Szotkowski
--=20
have been telling people at work that I have a special variant
of Tourette=E2=80=99s that is only triggered by reading or writing Java
                                               [William Morgan]



Attachments (1)

signature.asc (198 Bytes, application/pgp-signature)

In This Thread