From: "Michael T. Richter" Date: 2008-08-18T16:43:15+09:00 Subject: Re: End of Yaml --=-f4jRjofvvRjmONVRDEu5 Content-Type: multipart/alternative; boundary="=-OsZl9VN7sVX3ady5+X/u" --=-OsZl9VN7sVX3ady5+X/u Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2008-08-18 at 16:32 +0900, Charles Oliver Nutter wrote: > Michael T. Richter wrote: > > This whole __END__/DATA thing *does not work as expected*. It's yet=20 > > another situation where "principle of least surprise" doesn't work at=20 > > all in Ruby. Consider: >=20 > DATA is only provided for the file immediately executed on the command=20 > line. You read from DATA twice, so the second read is at EOF and returns = "". I am aware of this. My point is that relying on __END__/DATA for anything more than the most trivial of things is a recipe for getting bitten in the ass. Hard. If your code requires another file and that file consumes the DATA item, you're starved. If your code is required by another file then your DATA item vanishes and is replaced by that code's DATA item. Basically, absent a proper module system in Ruby, __END__/DATA is a toy and not suitable for use in anything resembling production code. --=20 Michael T. Richter (GoogleTalk: ttmrichter@gmail.com) I'm not schooled in the science of human factors, but I suspect surprise is not an element of a robust user interface. (Chip Rosenthal) --=-OsZl9VN7sVX3ady5+X/u Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, 2008-08-18 at 16:32 +0900, Charles Oliver Nutter wrote:
Michael T. Richter wrote:
> This whole __END__/DATA thing *does not work as expected*.  It's yet=20
> another situation where "principle of least surprise" doesn'=
t work at=20
> all in Ruby.  Consider:

DATA is only provided for the file immediately executed on the command=20
line. You read from DATA twice, so the second read is at EOF and returns &q=
uot;".

I am aware of this.  My point is that relying on __END__/DATA for anyt= hing more than the most trivial of things is a recipe for getting bitten in= the ass.  Hard.  If your code requires another file and= that file consumes the DATA item, you're starved.  If your code is required by another file then your DATA item vanishes and is = replaced by that code's DATA item.

Basically, absent a proper module system in Ruby, __END__/DATA is a toy and= not suitable for use in anything resembling production code.

--
Michael T. Richter <ttmri= chter@gmail.com> (GoogleTalk: ttmrichter@gmail.com)
I'm not schooled in the science of human factors, but I suspect surprise= is not an element of a robust user interface. (Chip Rosenthal)
--=-OsZl9VN7sVX3ady5+X/u-- --=-f4jRjofvvRjmONVRDEu5 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBIqSi9LqyWkKVQ54QRAq4GAKDdnSE7P6khkb8J/YT4s++AH4wJeQCdHGz7 k8PWWMsZWgK1jjGZnvdD9tU= =lCHf -----END PGP SIGNATURE----- --=-f4jRjofvvRjmONVRDEu5--