[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] parsing text from a file



On Wed, 28 Apr 1999, Matthew Langford wrote:

> On Mon, 26 Apr 1999, Chris Nandor wrote:
> 
> > \r and \n don't have consistent meanings across platforms.  On Mac, CRLF is
> > \n\r, and on Unix and DOS, it is \r\n.  Also, the above regex would (for a
> > DOS file on a Mac) convert all CRLFs to CRCRs, which likely isn't what you
> > want.  :)  Safer to use the explicit octals (\015\012) or hex chars
> > (\xD\xA).
> 
> Isn't this essentially just a MacPerl behavior?  For years, few
> distinguished between octal codes for \n and \r, on any platform including
> Macs, until a certain innocent design decision to remap these in MacPerl.
> 
It's not a *MacPerl* thing. It's MacOS.

> I guess it all started with the C programming language and "\n" as the
> universal force-a-new-line.  linefeed/lf/\n became EOL in a bazillion
> programs, so the platforms started having adjust to the code, rather than
> vice versa.  Perl could have done better, but really it has even deeper
> ties to the Unix tradition, so I can't blame it.
> 
It has always been an issue, but never so "in your face" until the
Internet really took off. Remember, it's only been during this decade that
we've had WWW. It's only been during this decade that if you're sending
email that you're very likely being supported by a private ISP using who
knows what platform. Prior to the early '90's I recall quite well that if
you were in a position to send or receive email, for example, that you
were likely on Unix and so were your correspondents (at least in
academia).

Perl is quite junior as a language, so its behaviour in this regard
started out as more driven by the underlying C than anything else. But it
has taken important steps to recognise the issue and deal with it.

C *was* Unix for a long time - and it *is* a pretty low-level language, so
both the decision to expose formatting codes and to not really think about
other platforms maybe made sense. Then it moved over into other OS's in a
big way starting in the '80's, but really taking off somewhere around the
beginning of this decade. Coincide a totally non-XPlatform
programming-supporting language with the increasing availability of
different OS's to supply text files to each other with different EOLs via
the Internet, and there you go.

So, MacPerl ain't the problem, in a nutshell. :-) But it's in the middle
of it.

Arved



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org