Closed Akuli closed 10 months ago
We will need the void
keyword anyway for void pointers. Will it be confusing if the same code uses both void
and None
?
declare free(ptr: void*) -> None
@littlewhitecloud I want to know what you think. Should Jou use -> void
(similar to C) or -> None
(similar to Python) when function does not return a value?
Is there an internal difference between void
and None
?
Currently None
is not used for anything in Jou. You can use it as a variable name, for example. However, the void
keyword has two meanings in Jou. Jou also has NULL
.
Currently:
void*
means "any pointer", i.e. the pointer type that can point to a value of any type-> void
means "this function does not return anything"NULL
is the null pointer, which is used as a special "missing" valueThis issue suggest changing Jou like this:
void*
means "any pointer", i.e. the pointer type that can point to a value of any type-> None
means "this function does not return anything"NULL
is the null pointer, which is used as a special "missing" valueNow that I write it out, I'm pretty sure this is a good idea. Thanks for asking a good question :)
I am sorry I came later, I also think jou should use -> None
.
Python typing uses
-> None
when there is no return value, Jou uses-> void
.Jou should switch to
-> None
, or at least display a good error message if someone uses-> None
.