[racket] COM: false = #t ???

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Tue Mar 18 01:42:21 EDT 2014

#lang racket/base
(require ffi/com)
(let ([com (com-create-instance "MSScriptControl.ScriptControl")])
   (com-set-property! com "Language" "VBScript")
   (com-invoke com "AddCode" "Function Test() \n Test=false \n End Function")
   (com-invoke (com-get-property com "CodeObject") "Test"))

Returns #t 
(Racket 6.0 win32) If I send to COM, all is ok:
(let ([com (com-create-instance "MSScriptControl.ScriptControl")])
   (com-set-property! com "Language" "VBScript")
   (com-invoke com "AddCode" "Function Test(x) \n If x then \n Test = 1 \n else \n Test =2 \n End if \n End Function")
   (com-invoke (com-get-property com "CodeObject") "Test" #f))  ; => 2

(let ([com (com-create-instance "MSScriptControl.ScriptControl")])
   (com-set-property! com "Language" "VBScript")
   (com-invoke com "AddCode" "Function Test(x) \n If x then \n Test = 1 \n else \n Test =2 \n End if \n End Function")
   (com-invoke (com-get-property com "CodeObject") "Test" #t))  ; => 1

And even 

(let ([com (com-create-instance "MSScriptControl.ScriptControl")])
   (com-set-property! com "Language" "VBScript")
   (com-invoke com "AddCode" "Function Test(x) \n If x = false then \n Test = false \n End if \n End Function")
   (com-invoke (com-get-property com "CodeObject") "Test" #f))
; => #t

(let ([com (com-create-instance "MSScriptControl.ScriptControl")])
    (com-set-property! com "Language" "VBScript")
    (com-invoke com "AddCode" "Function Test(x) \n If x = false then \n Test = x \n End if \n End Function")
    (com-invoke (com-get-property com "CodeObject") "Test" #f))
; => #f
-- 
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140318/1a3c8b75/attachment.html>

Posted on the users mailing list.