Text files driving me mad

Richard Gaskin ambassador at FourthWorld.com
Thu Jun 13 13:41:01 EDT 2002


Kee Nethery writes:

>>> This was the first message I posted when I bought MetaCard.  I was told that
>>> SuperCard had introduced this error, and MetaCard was maintaining
>>> compatibility.

Not entirely true: SuperCard and HyperCard do support the "cr" constant, but
in these cases the implementation is not at all in error. SuperCard and
HyoerCard are specific to Mac OS where the native line ending is ACII 13.
Consistent with the OS convention, "cr" appropriately denotes ASCII 13.

The "backward compatibility" aspect relates to the Rev/MC engine's UNIX
origins, where the native line ending is the lineFeed character (ASCII 10).
To support Mac-native HyperCard scripts, "cr" is maintained as the native
line ending for the engine but mapped to ASCII 10 for consistency with UNIX
conventions.

> I'm not using this capability right now but I might in the future. I
> have not tested to see whether returns are getting remapped to LF
> (Ascii 10) or not. But assuming this is true ... and if it is to
> maintain backward compatibility, I highly suggest the following fix.
> 
> Have the call keep returns at ascii 13 where they should be and only
> if someone does something like include a modifier like
> "returnToLinefeed" do you maintain backward compatibility with such
> an obvious flaw.

I like the idea of remapping to reflect reality.  I understand this means a
non-trvial amount of work for everything we ship, but in the interest of
seeing the Rev prosper I would gladly absorb the hit.  After all, we have to
assume that the total number of currectly-shipping Rev/MC-based apps is but
a small fraction of future-shipping apps.

A global property seems the simplest approach, just as with "hcAddressing".
Perhaps it could be called something like "useMacLineEndings":  when true,
"cr" maps to ACII 10, and when false it maps to the true value, ASCII 13,
and scripters would be encouraged to use "lf" (the true ASCII 10) for line
endings. 

I would advocate such a property be off by default, so the larger audience
which are new users will be unaffected, while current users will have the
experience necessary to add the one line of code needed to avoid rewriting
their apps, if desired ("set the useMacLineEndings to true").

Transcript/MetaTalk is arguably the most self-consistent of all xTalks, save
for a very small number of "gotchas" like the "cr" constant.  The earlier in
the product's life cycle these few inconsistencies are addressed, the
greater the benefit to long-term adoption of the language.

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 2.0: Publish any Database on Any Site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc




More information about the use-livecode mailing list