purged null from Hy

we already have `nil`, and `null` was barely ever used.
This commit is contained in:
gilch 2015-08-11 16:22:13 -06:00
parent 4834b59cba
commit a22e2ca4cc
7 changed files with 9 additions and 12 deletions

View File

@ -16,7 +16,7 @@
(defn parse-rfc822-stream [fd]
"Parse an RFC822 stream"
(setv bits {})
(setv key null)
(setv key None)
(for [line fd]
(if (in ":" line)
(do (setv line (.split line ":" 1))

View File

@ -81,7 +81,7 @@ def load_stdlib():
# keywords in Python 3.*
def _is_hy_builtin(name, module_name):
extras = ['True', 'False', 'None',
'true', 'false', 'nil', 'null']
'true', 'false', 'nil']
if name in extras or keyword.iskeyword(name):
return True
# for non-Hy modules, check for pre-existing name in

View File

@ -289,7 +289,6 @@ def t_identifier(p):
"true": "True",
"false": "False",
"nil": "None",
"null": "None",
}
if obj in table:

View File

@ -219,8 +219,8 @@ def test_ast_good_defclass():
def test_ast_bad_defclass():
"Make sure AST can't compile invalid defclass"
cant_compile("(defclass)")
cant_compile("(defclass a null)")
cant_compile("(defclass a null null)")
cant_compile("(defclass a None)")
cant_compile("(defclass a None None)")
def test_ast_good_lambda():

View File

@ -54,8 +54,6 @@
(except [e [TypeError]] (assert (in "Can't assign to a builtin" (str e)))))
(try (eval '(setv nil 1))
(except [e [TypeError]] (assert (in "Can't assign to a builtin" (str e)))))
(try (eval '(setv null 1))
(except [e [TypeError]] (assert (in "Can't assign to a builtin" (str e)))))
(try (eval '(defn defclass [] (print "hello")))
(except [e [TypeError]] (assert (in "Can't assign to a builtin" (str e)))))
(try (eval '(defn get [] (print "hello")))
@ -228,7 +226,7 @@
"NATIVE: test if cond sorta works."
(cond
[(= 1 2) (assert (is true false))]
[(is null null) (setv x true) (assert x)]))
[(is None None) (setv x true) (assert x)]))
(defn test-index []

View File

@ -3,8 +3,8 @@
(assert (= (unless false 1) 1))
(assert (= (unless false 1 2) 2))
(assert (= (unless false 1 3) 3))
(assert (= (unless true 2) null))
(assert (= (unless true 2) None))
(assert (= (unless true 2) nil))
(assert (= (unless (!= 1 2) 42) null))
(assert (= (unless (!= 1 2) 42) None))
(assert (= (unless (!= 1 2) 42) nil))
(assert (= (unless (!= 2 2) 42) 42)))

View File

@ -3,8 +3,8 @@
(assert (= (when true 1) 1))
(assert (= (when true 1 2) 2))
(assert (= (when true 1 3) 3))
(assert (= (when false 2) null))
(assert (= (when (= 1 2) 42) null))
(assert (= (when false 2) None))
(assert (= (when (= 1 2) 42) None))
(assert (= (when false 2) nil))
(assert (= (when (= 1 2) 42) nil))
(assert (= (when (= 2 2) 42) 42)))