Hi folks,
I think I may have found a tiny bug in core. So instead of going on IRC and crying to Peter, I though I'd try it myself this time. I have a file like this:
(print ((foreign-lambda* c-string ((blob x)) "x[0] = 65; return(x);") "xBC"))
When I run this, everything works:
$ ./type-test
However, I see a warning during compilation which I do not expect:
$ csc type-test.scm
Warning: at toplevel:
(type-test.scm:2) in procedure call to `g01', expected argument #1 of type `(or boolean blob)', but was given an argument of type `string'
This is what I've come up with:
diff --git a/support.scm b/support.scm
index 11b71bb..f7d7b85 100644
--- a/support.scm
+++ b/support.scm
@@ -1261,7 +1261,7 @@
((scheme-pointer nonnull-scheme-pointer) '*)
((blob)
(case mode
- ((arg) '(or boolean blob))
+ ((arg) '(or boolean blob string))
(else 'blob)))
((nonnull-blob) 'blob)
((pointer-vector)
And the warning disappears. Since the blob-type supports strings too, I think it makes sense to add this to support.scm. What do you think?
Thanks!
K.