Posted by N V Krishna on February 17, 2004 at 22:36:39:
In Reply to: Re: 2 easy questions posted by V. Ramakrishna on February 17, 2004 at 20:17:55:
: : I think you missed one of my previous questions:
: I'm having trouble coming up with the type rules for set!. Probably
: because there are multiple definitions that make sense. It's kind of like
: assignment in an OOP language in that it can change the run time type of a
: variable. But different because there's no declared type for variables in
: scheme. I guess my question is how do we deal with a program that has a
: set! which changes the type of a variable? Or even worse, conditionally
: changes the type of a variable? Does it just not type check if a set!
: changes the type?
Say we have
(set! a b) and we know the type of b to be int, then we say type of a is
int.
Say we have
(set! a b) and we know the type of a to be int, then we say type of b is
int.
Essentially the rules can be at some naive level similar to that of
(let ((a b)) a)
Warm regards,
Krishna.