User loginNavigation |
archivesAre extensible records first class patterns?If you have a language with extensible records (like those of Gaster and Jones), and you view functions like a -> Maybe { r } for some row r as patterns, are there practical obstacles that prevent you from extending the environment of a case alternative with the row of the result type of its controlling pattern? I would appreciate pointers to anywhere that this is discussed in the literature, or an explanation of why it is a bad idea. Google hasn't been especially helpful. -- concrete syntax for records is entirely made-up wildcard_pattern = const Just {} -- without first class labels, the compiler would have to make a whole family -- of declarations like this, one for each variable bound by a pattern variable_pattern_x val = Just { x := val } -- same comment applies as_pattern_x pat val = case pat val of Just rec -> { x := val, rec } Nothing -> Nothing -- I'm not 100% sure that this handles laziness correctly, but you get the idea -- declarations like this would be automatically generated from the datatype declarations cons_pattern pat_head pat_tail [] = Nothing cons_pattern pat_head pat_tail (x:xs) = case pat_head x of Just rec_head -> case pat_tail xs of Just rec_tail -> record_join rec_head rec_tail Nothing -> Nothing Nothing -> Nothing nil_pattern [] = Just {} nil_pattern _ = Nothing Peter LandinI was just forwarded a message that Peter Landin passed away yesterday.
Landin was one of the founders of our field, and did a lot of work of lasting value. We've discussed his papers here many times before, even though some of them were written decades ago. He did work that cast a long shadow, or phrased better, did work that illuminated wide vistas. |
Browse archivesActive forum topics |
Recent comments
22 weeks 3 days ago
22 weeks 3 days ago
22 weeks 3 days ago
44 weeks 4 days ago
48 weeks 6 days ago
50 weeks 3 days ago
50 weeks 3 days ago
1 year 1 week ago
1 year 5 weeks ago
1 year 5 weeks ago