PyHP-pph / PyHP_pph

This repository serves as a centre for collaboration on the PyHP++# language. It will also include a functioning interpreter and compiler for PyHP++# once the standard is finalised.
https://www.reddit.com/r/PyHP_pph/
GNU Affero General Public License v3.0
23 stars 3 forks source link

How will numbers work? #26

Open Kampfkarren opened 7 years ago

Kampfkarren commented 7 years ago

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.

prydt commented 7 years ago

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

Kampfkarren commented 7 years ago

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

prydt commented 7 years ago

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.)

ghost commented 7 years ago

IMO everything should be binary or base 65536.

ghost commented 7 years ago

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

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:

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

Kampfkarren commented 7 years ago

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