Re: continuation not a subtype of procedure
Kon Lovett via Chicken-users <[email protected]>
| Newsgroups | gmane.lisp.scheme.chicken |
|---|---|
| Message-ID | <[email protected]> |
the type `continuation' is to be used w/ https://wiki.call-cc.org/man/6/Module%20(chicken%20continuation) the type of a continuation captured by call/cc is a `procedure’ the https://wiki.call-cc.org/man/6/Types should reference > On Aug 20, 2026, at 9:09 AM, Hernán Ibarra Mejia via Chicken-users <[email protected]> wrote: > > Greetings, > > I am new to using the type system, so this is probably a mistake on my part. > When passing continuations around I get compiler warnings with the > `-strict-types` flag. Here is a MWE: > > ``` > ; test.scm > (import (scheme base)) > > (: send-message (continuation -> noreturn)) > (define (send-message k) (k "Hello world!")) > > (display (call/cc (lambda (k) (send-message k)))) > (newline) > ``` > > When compiling: > > ``` > % csc -strict-types test.scm > > Warning: Invalid procedure > In file `test.scm:4', > In procedure `send-message', > In procedure call: > > (k "Hello world!") > > Variable `k14' is not a procedure. > > It has this type: > > (struct continuation) > ``` > > The program works as expected, i.e., it prints "Hello world!" but the warning > seems unwarranted. For truly unexpected behaviour, replace the definition of > `send-message` with: > > ``` > (define (send-message k) (k (procedure? k))) > ``` > > Then the program prints #f or #t depending on whether `-strict-types` is used or > not, respectively. > > I am using this version of csc (congrats on the CHICKEN 6 release, by the way): > > ``` > % csc -version > CHICKEN > (c)2000-2007 Felix L. Winkelmann, (c)2008 The CHICKEN Team > Version 6.0.0rc3 ((HEAD detached at 6.0.0rc3)) (rev 0e61d660) > linux-unix-gnu-x86-64 [ 64bit dload ptables ] > ``` > > What am I missing? Shouldn't the continuation type be a subtype of the procedure > type? > > Cheers, > Hernán >