text in fields (CR/LF, CR, LF) which is correct?
J. Landman Gay
jacque at hyperactivesw.com
Fri Aug 30 12:21:01 EDT 2002
Dar Scott <dsc at swcp.com> wrote:
> I would prefer a new constant named lineEnd that is _Revolution_
> specific. This would allow the same stack to move across platforms
> without line end changes.
That's pretty much what "cr" and "return" do already.
> For backwards compatibility, it should
> be ASCII 10. Maybe there can be a short name, but line and end are
> already taken.
> With that, new constants asciiCR, asciiLF, and asciiCRLF are also
> With the above, use of return and CR can be discouraged. And
> lineFeed and CRLF need not be used.
> However, I've seen examples from old timers on the list that
> include return quite a bit. I find that jarring and sometimes
> confusing. Yet, others might find it quite natural.
It's a holdover from HyperCard and SuperCard, where "return" has been in
use since the beginning. As you say, it's very natural for anyone coming
from another xtalk environment. The synonym "cr" is what others probably
want to use, it's the same thing.
I'm not convinced we need a new constant though, but of course I could
easily be missing something. I have always just used "cr" or "return"
(interchangeably) and line endings have always been converted correctly
no matter what platform I move my stack to. Never had any problems with
it. If hard binary data needs to be converted, as in the case we've been
discussing, then I just replace the appropriate ascii characters with
"cr" or "return" and it fixes things. This also works when writing text
files; the correct line endings get written depending on the platform. I
suppose if you were writing binary data, you'd need a switch statement
to write the correct line endings depending on platform, but those
constants already exist.
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the Use-livecode