Browse thread
RE: Record typing question
- Don Syme
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 1999-11-04 (17:53) |
From: | Don Syme <dsyme@m...> |
Subject: | RE: Record typing question |
>Spooky, I raised this point a few days ago! Ah ha - I see that now. I haven't been keeping up to date with the discussion list! > type 'a foo = { a: 'a; b: 'a } > let f x = { x with a = 1 } > Here "f: 'a foo -> int foo" won't wash, because the "b" field will > stay an int, contra the definition. Before lifting the current > restriction, one would have to check that no type equalities between > fields are broken. I guess it should be f: int foo -> int foo. All the field assignments would act in parallel as far as the type system goes, so type 'a foo = { a: 'a; b: 'a; c: int } let f x = { x with a = [x.a]; b = [x.b] } would be f: 'a foo -> 'a list foo Cheers, Don