[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] using types
From: |
Jörg F . Wittenberger |
Subject: |
Re: [Chicken-users] using types |
Date: |
22 Feb 2013 14:17:50 +0100 |
On Feb 21 2013, Jörg F. Wittenberger wrote:
Somehow I can't verify that my type declarations are actually
effective.
I've been able to verify that my .types files are not ever consulted.
Using strace I found that the "foo.types" file is searched for in
stat("/usr/lib/chicken/6/foo.types", 0x7fffc1895400) = -1 ENOENT (No such
file or directory)
But since that's not an extension but just a simple module, which is
part of a larger program, there is no good reason to ever install
the .types file in the repository.
To deal with the issue I tried to use -setup-mode. No effect at all.
Further it seem to be the case that CHICKEN_REPOSITORY must be s imple
directory and may not be some colon-separated path.
At this moment I don't see any solution how to make chicken read
the .types files it produced *within* a single directory.
How would I do that?
Thanks a lot!
/Jörg
So far I noticed that when I make usage-error wrt. types I
- within a single file that is -
get an error in tje compilation step.. Which is what I like.
Now that I've got a .types file for each module, I tried to
enforce this situation by violating the declared procedures
signature. But it did *not* give me the expected error.
Maybe I'm doing something wrong?
So far I'm relying on these lines from "manual/Types":
If library code is used with {{require-extension}} or {{(declare (unit
...))}} and a {{.types}} file of the same name exists in the
extension repository path, then it is automatically consulted. This
allows code using these libraries to take advantage of type-information
for library definitions.
I have a file foo.types, which declares
(: bar (fixnum) -> . *)
in foobar.scm I have
(declare
(unit foobar)
(uses foo)
...)
but the attempt to provoke an error by calling
(bar some-fixnum-which-is-from-working-code-anyway 27)
-- which clearly violates the given signature above giving
the additional parameter "27"
(while the signature in turn was verified to be correct in foo.types)
I did *not* result in any warning, let alone the stop-compile-on-error
I hoped to receive.
I'd like to add that prior to this experiment I went without
the (declare ... (uses foo) ...) having only an import statement
(import foo) in my foobar.scm - while this would be an analogous
use to the declare-variant it would be undocumented AFAI can see.
Now I dunno how I can make (sure) use of my type declarations
short of manually adding a "-types foo.types" entry for each an
every import in the scheme source to my Makefile.
Any help much apprecuated.
/Jörg
....
_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-u