--0NB0lE7sNnW8+0qW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2006.10.13 09:11, Kenneth McDonald wrote:
> I'm slowly doing more in Ruby (in addition to what I do in Python), as I=
=20
> like the cleanliness of the language. However, one thing that I really=20
> _don't_ like is the fact that an attempt to access a non-existent list=20
> item silently returns nil, rather than throwing an exception. Is there a=
=20
> way to make this more strict? Hashes have the same behavior, but since=20
> they can be assigned a default block, that isn't nearly so much of a=20
> problem.
>=20
> I know I could change List behavior, but there are very obvious reasons=
=20
> why that's a Bad Thing. I could also subclass list, but then I miss all=
=20
> of the syntactic niceties of lists. And both solutions impose an extra=20
> level of calling for what will be very frequent actions.
>=20
> Any thoughts welcome,

Since you asked.. :)

We have managed to make do without Array access raising exceptions.

I would REALLY recommend leaving behind the baggage of any previous
languages and take a head-first plunge. In Ruby, Array access returns
a nil if the index is not found. Embrace it! Form your code around the
Ruby idioms, not the other way around!

The payoff will be much greater.

--0NB0lE7sNnW8+0qW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFLxST7Nh7RM4TrhIRAjpEAKCQekkcNy/tTJzz3MxSz4kkugUdpQCeMPmc
kkOnmdXhHvQisA5lAw49GpA=
=AUNS
-----END PGP SIGNATURE-----

--0NB0lE7sNnW8+0qW--