[plt-scheme] HtDP Section 14: stricter typing for eye color?

From: Terrence Brannon (metaperl at urth.org)
Date: Sun Feb 15 22:48:53 EST 2004

Robby Findler wrote:

>At Sat, 14 Feb 2004 08:39:02 -0500, Terrence Brannon wrote:
>  
>
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>>In this section, a data definition for a family tree is developed...
>>
>>However, there are no restrictions on eye color, yet I think eye color 
>>should, in the terminology of Pascal and MySQL, be an enumerated type 
>>with only certain things allowed in that field.
>>
>>How does one typically enforce such restrictions in Scheme?
>>    
>>
>
>In HtDP, data definitions are not program artifacts, per se. They live
>in comments.
>

Comments do not enforce type safety. A comment in a program does not 
prevent me from putting something there that never belongs there, 
perhaps by a typo or some sort of intentional malice.

>
>FWIW, this is one of the clear advantages of Scheme over languages like
>Pascal -- types can correspond to subsets of other types.
>
>  
>
Now you really have me lost: how in the heck is something in a comment 
going to force the eye-color to only be one of a set of symbols? I am 
sure you are familar with the concept of an enumerated type. How does 
one restrict the value for eye color ?

>Robby
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20040215/9293e069/attachment.html>

Posted on the users mailing list.