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

Rename long to int64? #515

Open
Akuli opened this issue Aug 19, 2024 · 3 comments
Open

Rename long to int64? #515

Akuli opened this issue Aug 19, 2024 · 3 comments

Comments

@Akuli
Copy link
Owner

Akuli commented Aug 19, 2024

C has long that is 32 bits on Windows and 64 bits on many other platforms. Jou has long which is always 64 bits. This causes confusion when combining C code with Jou code. That's bad, because working with C is a very important feature in Jou.

I think Jou long should be renamed to int64. @littlewhitecloud What do you think?

@littlewhitecloud
Copy link
Contributor

littlewhitecloud commented Aug 20, 2024

C has that is 32 bits on Windows and 64 bits on many other platforms. Jou has which is always 64 bits. This causes confusion when combining C code with Jou code. That's bad, because working with C is a very important feature in Jou.long``long

I think Jou should be renamed to . @littlewhitecloud What do you think?long``int64

It's up to you :)
Other programming language (rust?) seems use names like this too (i64 i32)

@Akuli
Copy link
Owner Author

Akuli commented Aug 20, 2024

I don't want Jou to use i32 because Python programmers know int, and int is almost always 32 bits nowadays.

@Akuli
Copy link
Owner Author

Akuli commented Sep 29, 2024

I think integer types should be:

bits signed unsigned
8 int8 byte
16 int16 uint16
32 int uint
64 int64 uint64

Advantages:

  • Simple
  • Relatively short
  • Somewhat consistent with other languages
  • Easy to tell how many bits each data type is (execpt int)
  • If name of type contains int, the rest of it describes how it differs from plain old int

Disadvantages:

  • int8 and byte are inconsistent.
  • It is weird that 32-bit numbers don't contain 32 anywhere.

I don't want to use signed byte because then signed byte is the only type with a two-word name.

I don't want to use uint8 because then every Jou beginner would ask "is that a byte?".

As already mentioned, I want to use int (not int32) because people are used to it.

As described in this issue, I don't want to use long, because C's long is 64-bit on linux but only 32 bits on Windows.

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