[clean-list] Selecting record fields with same names
Claudio Potenza
claudio.potenza@mclink.it
Sat, 09 Feb 2002 17:09:12 +0000
Hello everybody,
I have question about the selection of record fields:
if I create two record types having fields with the same name, I seem
to be incapable to select the fields (I am using the new Clean 2.0).
Example:
1: module test
2:
3: import StdEnv
4:
5: :: Rec1 = { i:: Int, s:: String, r:: Real }
6: :: Rec2 = { i:: Int, s:: String }
7:
8: appendStrings :: Rec1 Rec2 -> String
9: appendStrings r1 r2 = r1.s +++ r2.s
10:
11: Start=appendStrings {Rec1 | i=0,s="str1",r=0} {Rec2 | i=0,s="str2"}
in line 9 the compiler should be able to tell that 'r1' is of type 'Rec1'
(the function type will tell this), but I get the following error:
Error [test.icl,9,]: s ambiguous selector specified
Am I forced to have different names for the fields? (The language report
says that this is not the case)
Claudio Potenza
claudio.potenza@mclink.it