PyHP_pph icon indicating copy to clipboard operation
PyHP_pph copied to clipboard

There should be multiple ways to express an absence of a value

Open as-com opened this issue 8 years ago • 6 comments

For example, JavaScript has both null and undefined to express an absence of a value. PyHP++# should have multiple ways of expressing a lack of value, each with its own special behavior.

as-com avatar Jun 18 '17 00:06 as-com

If we're just going based on our source languages, our options are null, NULL, and 0.

EDIT: Oh, and nullptr.

Kampfkarren avatar Jun 18 '17 00:06 Kampfkarren

And None from Python

as-com avatar Jun 18 '17 00:06 as-com

Should they all be aliases for each other? If not, should they equal each other?

Kampfkarren avatar Jun 18 '17 00:06 Kampfkarren

They should all mean slightly different things and be used in slightly different contexts.

ghost avatar Jun 19 '17 17:06 ghost

There should be an order of precedence for these values, in case people decide to compare them to each other. For example, if the order was something like:

  • undefined
  • None
  • no
  • any valid data type

then comparing, for example, undefined == None would return undefined, and comparing 5 == no would return no.

mzhang28 avatar Oct 24 '17 02:10 mzhang28

@iptq Love this idea. I may implement it into the specs if I get the time, or you can write your own if you like.

ghost avatar Oct 24 '17 05:10 ghost