source-academy / py-slang

Python sublanguage for SICP
Apache License 2.0
0 stars 0 forks source link

We should represent the empty list by None in Python #20

Closed martin-henz closed 5 months ago

martin-henz commented 6 months ago

That's not right: Syntactically, null is an identifier in Python. So it should be allowed anywhere where we can use identifiers:

null = 1

which is currently not allowed.

The result of a telegram discussion is this: We should represent the empty list by None in Python. Python's None will be represented by the JavaScript literal null.

The identifier null in Python should be allowed in Python §1. For the estree to represent a valid JavaScript program, we should add a $ in front of null. An unparse function will strip away the $ before any etree is presented to the user as a Python program.

martin-henz commented 5 months ago

Current status:

null = 1
which is currently not allowed.

resolved

The result of a telegram discussion is this: We should represent the empty list by None in Python. Python's None will be represented by the JavaScript literal null.

not resolved: None is still mapped to undefined.

The identifier null in Python should be allowed in Python §1. For the estree to represent a valid JavaScript program, we should add a $ in front of null. An unparse function will strip away the $ before any etree is presented to the user as a Python program.

resolved