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

ISO-Latin 1 characters with Linux does not work version 4.02.3-9 for Debian #7740

Closed
vicuna opened this issue Feb 21, 2018 · 3 comments
Closed

Comments

@vicuna
Copy link

vicuna commented Feb 21, 2018

Original bug ID: 7740
Reporter: vanto
Status: resolved (set by @xavierleroy on 2018-02-21T14:52:00Z)
Resolution: not a bug
Priority: normal
Severity: minor
Platform: Linux
OS: Debian
OS Version: 9
Version: 4.02.3
Category: compiler driver
Related to: #7737

Bug description

version 4.02.3-9 for Debian

vanto@debian9:~$ ocaml
OCaml version 4.02.3

int_of_char ('a');;

  • : int = 97

int_of_char (_'é');;;

Warning 3: deprecated: ISO-Latin1 characters in identifiers
Error: Syntax error: operator expected.

this error also occurs with version 4.01.0-5 for Debian.

Steps to reproduce

Type in a terminal (linux) int_of_char ('é');;
then Enter
at this moment a warning and an error message appears, but the line
has changed.
an underscore was added under the first apostrophe and a third
semi-colon appeared after the other two as you can see above. (I
had to add the underscore here because it was not saved in the copy and
paste.But in reality the underscore is well below the first apostrophe)

@vicuna
Copy link
Author

vicuna commented Feb 21, 2018

Comment author: @xavierleroy

You really need to ask for help on discuss.ocaml.org rather than post reports here: that will get you more friendly feedback.

Your Debian terminal is using Unicode with UTF-8 encoding, not ISO Latin 1. So, what looks to you like a correct character literal 'é' actually looks to OCaml like '\xc3\xa9', that is, two bytes between the quotes. Check forr yourself:

$ cat > foo
int_of_char ('é');;
$ od -t c foo
0000000 i n t _ o f _ c h a r ( ' 303 251
0000020 ' ) ; ; \n
0000025
$ od -t x1 foo
0000000 69 6e 74 5f 6f 66 5f 63 68 61 72 20 28 27 c3 a9
0000020 27 29 3b 3b 0a
0000025

If you really want to use ISO Latin 1 accented characters, you'll need to configure a console and a text editor to use this encoding instead of Unicode/UTF8. That's nontrivial and a reason why most of us just no longer use accented characters in OCaml sources, except in comments and possibly strings.

Oh, by the way: the parentheses in int_of_char ('a') are not needed and considered poor style.

@vicuna vicuna closed this as completed Feb 21, 2018
@vicuna
Copy link
Author

vicuna commented Feb 21, 2018

Comment author: vanto

Replying to the administrator.
Haskell in linux works fine. Splendid is'nt it?
Why OCaml is not better ??????? Waterloo again?
Change the code page to fit all systems. After all, it's not up to the
user to adapt to the quirks of the compiler. We are in the twenty-
first century. It is urgent to adapt.
What do you do with the characters that the compiler has added of
itself in the expression? This is not a bug?

"... that will get you more friendly feedback." You say.
What does that mean?

"Oh, by the way: the parentheses in int_of_char ('a') are not needed and considered poor style." You say.
One more thing.
If you consider this style of writing as poor, what are you waiting for to erase it from the compiler?
Since the compiler allows me to write it.
After all, it's you who made this compiler! CQFD.

@vicuna
Copy link
Author

vicuna commented Feb 21, 2018

Comment author: @xavierleroy

You crossed the line. This is a bug tracking system, not a place to vent your frustrations. That was your last post here.

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

No branches or pull requests

1 participant