Am 04.07.2015 um 06:53 schrieb Evan Hanson: > Hi Jörg, > > It's as the others say: the scrutinizer differentiates between true and > false, so your assignment of one over the other breaks the assumptions > that strict-types implies.
I understood that already. Thanks for the explanation anyway. > You'd have similar problems if you `set!` a > fixnum to a float, or an input-port to an output-port, and so on. With > strict-types, a variable should not change from any one of the types > listed on http://wiki.call-cc.org/man/4/Types to any other. For the float vs. fixnum case, I had been less surprised. But the type rules are pretty clear. "false" and "true" are just in so far actually an unintuitive case as Felix pointed out. > That said, it would be useful if `:` or `the` could override inferred > types for this purpose, so that one could safely say, for example: > > (let ((a (the boolean #t))) > ... > (set! a #f) > ... > (if a 'either 'or)) > > (This might also make no sense; I'm not sure just now.) That's actually possible and I must admit that I did so quite some times when I had to have a variable changing type. However my source goes through some trick (which might no longer be necessary, I never re-checked). This xthe syntax does the trick for me: (: xthe-identity-inline (* --> *)) (define-inline (xthe-identity-inline x) x) (define-syntax xthe (syntax-rules () ((_ type val) (the type (xthe-identity-inline val))))) _______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
