User loginNavigation 
Constant Values as TypesThis is probably one of those naive I should first finish the Pierce book kind of questions, but here goes anyway: Are there languages where a constant value, such as 42, can act is its own type? So putting this in realworld terms, in the Cat language I can write the following function with a type annotation: define the_answer : ()>(int) { 42 } However, it seems that I am being too general by saying it returns an int in the type annotation because it always returns 42 (edit: which we could say is a subtype of int). So ... shouldn't the type annotation be: define the_answer : ()>(42) { 42 } So the more general question is: what is good / bad about this? By cdiggins at 20060902 23:59  LtU Forum  previous forum topic  next forum topic  other blogs  4897 reads

Browse archivesActive forum topics 
Recent comments
7 hours 18 min ago
8 hours 41 min ago
9 hours 20 min ago
9 hours 44 min ago
10 hours 41 min ago
11 hours 30 min ago
17 hours 39 min ago
18 hours 12 min ago
18 hours 24 min ago
1 day 10 hours ago