[nem-bug] [Nemerle 0000646]: Clarification req. about typing system
feedback at nemerle.org
feedback at nemerle.org
Mon Apr 3 22:20:37 CEST 2006
A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=646>
======================================================================
Reported By: SeamusL
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 646
Category: Compiler
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 04-03-2006 21:48 CEST
Last Modified: 04-03-2006 22:20 CEST
======================================================================
Summary: Clarification req. about typing system
Description:
Where 'a : 'b, can it follow that Iface['a] : Iface['b]?
I can't implement several instances of a generic interface. Is this a
feature or not working or am I just doing things incorrectly? I would like
to implement an interface for several, but not all, subtypes of a base
type.
See attached commented code for my gripes.
Sorry if this is mis-classified. I am unsure about the nature of the
problems I face (features, bugs, my own stupidity.)
======================================================================
----------------------------------------------------------------------
nazgul - 04-03-06 22:20
----------------------------------------------------------------------
There are several issues:
1) you say that compiler did not infer IComparable interface for
DefContainsImpl, this is not true, as you can see in my attached example.
Probably the problem was the need for upcast to IComparable, which is
needed for type parameters (and explicitly implemented interfaces) - it
statically typesafe, but needed in Nemerle and C#.
2) the IComparable, which you added to DefContainsImpl causes for ugly
problems with compiler:
- the internal compiler error you observed, which is of course a bug
- CheckSTV, I guess it is a known bug, the message is very unclear, but
means that default type used (object) does not satisfy 'a : IComparable
['a]
- the 'typing constraint on 'a not satisfied, upon instantiation of
DefContainsImpl', which is a little bit unclear, but true - Thing does not
implement IComparable [Thing] (it just derives implementation of
IComparable [Entity])
3) the last obstacle is by design at the moment - the limitation (which is
not present in C#) is quite important for type inference algorithm used in
Nemerle compiler, because it simplifies reasoning about how given type
implements some interface. I guess changing this is possible, but Michal
who designed the alorithm would know better
Issue History
Date Modified Username Field Change
======================================================================
04-03-06 21:48 SeamusL New Issue
04-03-06 21:48 SeamusL File Added: test1.n
04-03-06 22:10 nazgul File Added: t.n
04-03-06 22:20 nazgul Note Added: 0001152
======================================================================
More information about the bugs
mailing list