Akuli / jou

Yet another programming language
MIT License
12 stars 4 forks source link

None return #423

Closed Akuli closed 10 months ago

Akuli commented 10 months ago

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.

Akuli commented 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?

Moosems commented 10 months ago

Is there an internal difference between void and None?

Akuli commented 10 months ago

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:

This issue suggest changing Jou like this:

Now that I write it out, I'm pretty sure this is a good idea. Thanks for asking a good question :)

littlewhitecloud commented 10 months ago

I am sorry I came later, I also think jou should use -> None.