Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native eol style #844

Open
olopierpa opened this issue Jun 21, 2024 · 4 comments
Open

native eol style #844

olopierpa opened this issue Jun 21, 2024 · 4 comments

Comments

@olopierpa
Copy link
Contributor

> (native-eol-style)
none

This is fine if one only wants to read nl-style files. But it makes the default transcoder useless on windows as it makes any code using the default transcoder not able to read correctly native files.

And since there are functions like call-with-input-file which do not take a transcoder argument, it is impossible to use these functions to read native eol-style files on windows (I know that one can work around this by using Chez specific current-transcoder parameter, but let's suppose one wants to write portable code as much as reasonably possible.)

I'd call this a bug, but maybe there's a rationale for this behavior?

@jltaylor-us
Copy link
Contributor

If one wants to write portable code as much as reasonably possible then one would always explicitly provide a transcoder, since the r6rs spec says that the default transcoder is implementation defined.

@olopierpa
Copy link
Contributor Author

One supposes that the implementation defines it in a reasonable way. native-eol-style=none is not reasonable in any platform. It only half-works on unix by chance.

How do I provide my transcoder to call-with-input-file?

Having to rewrite my own version of call-with-input-file because the system supplied one is broken is not reasonable.

@jltaylor-us
Copy link
Contributor

You already know how to provide a transcoder that will be used with call-with-input-file; you said so in the initial post. If you are asking how do that in some way that's portable to other scheme implementations then the answer is you can't, which means you can't use call-with-input-file in 100% portable code if your code is sensitive to anything influenced by the transcoder that the implementation uses.

I don't know what you could possibly mean by portable code except writing to a specification (presumably r6rs, the last complete specification). The behavior clearly conforms to the specification.

Just because you don't like the way it works doesn't mean it's broken. It's not like there aren't other reasonable interpretations of what the default behavior should be. I find it reasonable that the default behavior does not silently change a character stream of valid utf-8 encoded characters when they are read from a file on any platform, and that a program that writes characters out to a file produces byte-identical output on all platforms. That's not to say it can't change (although it is a significant backwards incompatibility), but calling it broken and appealing to portability concerns isn't going to get you anywhere.

@olopierpa
Copy link
Contributor Author

I don't need to go anywhere.

Only, I wish I had not wasted the time I wasted chasing bugs caused by this perfectly fine and R6RS compliant behavior of Chez, and was trying to spare the pain to others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants