PyHP_pph icon indicating copy to clipboard operation
PyHP_pph copied to clipboard

How will numbers work?

Open Kampfkarren opened this issue 8 years ago • 6 comments

Is there just a basic number type? Is it like C(++) with long, double, int, etc? Is there signed and unsigned? Can you add "f" to the end of a number to treat it like a float? Is there hexadecimal support? Octal? Binary? When you type a number on its own, what type is it treated as? These are great topics for a specification if we can all agree on the details.

Kampfkarren avatar Jun 18 '17 02:06 Kampfkarren

I suggest, since we are lacking in c# attributes, that we use int, double, and long.

prydt avatar Jun 18 '17 04:06 prydt

Should everything be signed like C#? Or give the option like in C++?

Kampfkarren avatar Jun 18 '17 04:06 Kampfkarren

I'd suggest that we give the option, but we should wait for more people's suggestions. (We can, of course, change the specs later.)

prydt avatar Jun 18 '17 05:06 prydt

IMO everything should be binary or base 65536.

ghost avatar Jun 19 '17 18:06 ghost

I think we should have C++-style primitive number types:

  • int (actually a long)
  • float (actually a double)
  • uint (unsigned)
  • ufloat (unsigned)

But then again, I've always liked the idea of fixed-width integer types. i prefixes signed ints, u prefixes unsigned ones, and then you put the width in bits, so:

  • i8 is like C(++)'s signed char.
  • u64 is like C(++)'s unsigned long long.
  • i32 is like C(++)'s int (on most platforms).

But none of our inspiration languages do this (except C(++)'s xintxx_t types, but they're typedefed in stdint.h).

ghost avatar Jun 22 '17 20:06 ghost

IIRC IL (the intermediate language C# compiles to) has Int32, Int16, Int64, etc.

Kampfkarren avatar Jun 22 '17 20:06 Kampfkarren