summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-12-10 16:31:14 +0100
committerIan Price <ianprice90@googlemail.com>2013-09-09 17:01:23 +0100
commitae037892f0008c9d05f9c0a090618d013a6dcfbb (patch)
tree4c32a57e0c11e286a1dc70c303a2dbee76bab946
parent48f7c66a40f9357e10691caafac87355a17a3dec (diff)
downloadguile-ae037892f0008c9d05f9c0a090618d013a6dcfbb.tar.gz
remove true? and false?; lua's truthiness and falsehood is guile's.
* module/language/lua/runtime.scm (true?, false?): Remove, now that #nil is false. * module/language/lua/compile-tree-il.scm: Don't emit calls to true? or false?.
-rw-r--r--module/language/lua/compile-tree-il.scm16
-rw-r--r--module/language/lua/runtime.scm18
2 files changed, 8 insertions, 26 deletions
diff --git a/module/language/lua/compile-tree-il.scm b/module/language/lua/compile-tree-il.scm
index 41f86e5a6..cd79e76ef 100644
--- a/module/language/lua/compile-tree-il.scm
+++ b/module/language/lua/compile-tree-il.scm
@@ -44,10 +44,6 @@
"Apply a function in the (language lua runtime) module"
(make-application src (ref-runtime src name) arguments))
-(define (make-lua-conditional src condition then else)
- "Generate a conditional with (@ (language lua runtime) true?)"
- (make-conditional src (make-runtime-application src 'true? (list condition)) then else))
-
(define (make-table-ref src table index)
(make-runtime-application src 'index
(list table (if (symbol? index) (make-const src (symbol->string index)) index))))
@@ -78,7 +74,7 @@
(apply-named-lua-function
src "while"
(lambda (loop)
- (make-lua-conditional
+ (make-conditional
src
condition
(make-sequence src
@@ -300,9 +296,9 @@
(begin
;; if not (var and limit and step) then error() end
(if (apply (primitive not)
- (if (apply (@ (language lua runtime) true?) (lexical variable ,gs-variable))
- (if (apply (@ (language lua runtime) true?) (lexical limit ,gs-limit))
- (if (apply (@ (language lua runtime) true?) (lexical step ,gs-step))
+ (if (lexical variable ,gs-variable)
+ (if (lexical limit ,gs-limit)
+ (if (lexical step ,gs-step)
(const #t)
(const #f))
(const #f))
@@ -377,13 +373,13 @@
(list left right)))))
result))
((#:or)
- (make-lua-conditional
+ (make-conditional
src
left
left
right))
((#:and)
- (make-lua-conditional
+ (make-conditional
src
left
right
diff --git a/module/language/lua/runtime.scm b/module/language/lua/runtime.scm
index 8bf7e3da9..c9fcf5895 100644
--- a/module/language/lua/runtime.scm
+++ b/module/language/lua/runtime.scm
@@ -28,11 +28,7 @@
#:use-module ((srfi srfi-98) #:select (get-environment-variable))
#:use-module ((system base compile) #:select (compile read-and-compile))
- #:export (
- runtime-error
-
- ;; semantics
- false? true?
+ #:export (runtime-error
;; misc
value-type->string
@@ -92,16 +88,6 @@
(define (runtime-warning string . arguments)
(apply format (cons #t (cons (string-append "LUA: RUNTIME WARNING: " string "\n") arguments))))
-;;;;; SEMANTICS
-
-(define (false? x)
- "Wrapper for Scheme's false semantics that considers #nil to be false"
- (or (eq? x #f) (eq? x #nil)))
-
-(define (true? x)
- "Inversion of false?"
- (not (false? x)))
-
;;;;; MISCELLANEOUS
(define (value-type->string x)
@@ -333,7 +319,7 @@
(define-global (assert v . opts)
(define message (if (null? opts) "assertion failed" (car opts)))
- (if (false? v)
+ (if (not v)
(runtime-error message)
(apply values (cons v opts))))