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

Newline Escaping #596

Closed
cookrn opened this issue Nov 23, 2021 · 1 comment
Closed

Newline Escaping #596

cookrn opened this issue Nov 23, 2021 · 1 comment

Comments

@cookrn
Copy link
Contributor

cookrn commented Nov 23, 2021

I think there might be conflicting direction between step 1 (reader) and step 4 (if/fn/do) as it relates to basic newline escaping/unescaping in strings. I'm currently working through the tutorial in Ruby and worked on getting this test to pass in step 1:

https://github.com/kanaka/mal/blob/master/impls/tests/step1_read_print.mal#L248-L249

"\n"
;=>"\n"

Then, in step 4, related to #289, the test is as follows:

https://github.com/kanaka/mal/blob/master/impls/tests/step4_if_fn_do.mal#L298-L299

"\\n"
;=>"\\n"

I find the two different tests a bit conflicting, but maybe I'm not understanding. My implementation treats the step 4 test as an error with an invalid use of \ chars. It is the only test failing out of steps 0/1/2/3/4.

Is the step 1 test detecting whether a raw newline can be read and then printed back? Then, the test in step 4 is checking whether an escaped newline is NOT read in as a raw newline and instead behaves as escaped? Thanks in advance for any insight to this issue.

As an aside, I've found the tutorial really well done and have enjoyed working through it. Great job!

@cookrn
Copy link
Contributor Author

cookrn commented Nov 26, 2021

I think after looking again/further, this is based on a misunderstanding on my part. I'll review and compare with the existing Ruby implementation. Thanks again for the great project!

@cookrn cookrn closed this as completed Nov 26, 2021
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

1 participant