Marco,

Inheriting generic classes, indeed, currently does not work. We have 
been using workarounds for this issue, like pushing genericity into 
subclasses and relying on specialization instead of inheritance.

Vassily

On 01/19/15 11:01, Marco Postigo wrote:
> Hello,
> I've worked with Chapel 2 years ago where it still was in version 0.7 or
> something. Already there I had problems to inherit from a generic class and 
> got
> compile errors. Now I've started working with Chapel again and downloaded the
> latest version (1.10.0) and wanted to implement a library for global load
> balancing for my master thesis. Unfortunately I still get a compile error when
> trying to inherit from a generic class and wondering if I'm doing something
> wrong or if it is really a bug.
> My Code:
>     1 class A {
>     2    type t;
>     3 }
>     4
>     5 class B : A {
>     6 }
>     7
>     8 proc main() {
>     9    var b = new B(int);
>    10 }
> I've tried a lot of combinations (declaring the constructors explicitly, 
> trying
> different types, using new B(), etc.) but nothing worked... the error I get 
> from
> the compiler is the following:
> $ chpl -o inheritance-test tests/GenericInheritanceTest.chpl
> tests/GenericInheritanceTest.chpl:8: In function 'main':
> tests/GenericInheritanceTest.chpl:5: error: unresolved type specifier 
> 'B(t=type
> int(64))'
> tests/GenericInheritanceTest.chpl:5: note: candidates are: B
> tests/GenericInheritanceTest.chpl:5: note: did you forget the 'new' keyword?
> When I add the type t field also to class B I get another internal error...
> Code:
>     1 class A {
>     2    type t;
>     3 }
>     4
>     5 class B : A {
>     6    type t;
>     7 }
>     8
>     9 proc main() {
>    10    var b = new B(int);
>    11 }
> Output:
> $ chpl -o inheritance-test tests/GenericInheritanceTest.chpl
> tests/GenericInheritanceTest.chpl:5: internal error: CAL0056 chpl Version 
> 1.10.0
> Changing the type attribute name to t1 to not have a duplicate type field also
> results in an error:
> $ chpl -o inheritance-test tests/GenericInheritanceTest.chpl
> tests/GenericInheritanceTest.chpl:9: In function 'main':
> tests/GenericInheritanceTest.chpl:10: error: unresolved call 'B(type int(64))'
> tests/GenericInheritanceTest.chpl:5: note: candidates are: B(type t, type t1)
> and trying to use the (implicit generated) constructor B(type t, type t1) also
> results in another error:
> $ chpl -o inheritance-test tests/GenericInheritanceTest.chpl
> tests/GenericInheritanceTest.chpl:9: In function 'main':
> tests/GenericInheritanceTest.chpl:5: error: unresolved type specifier 
> 'B(t=type
> int(64), t1=type int(64))'
> tests/GenericInheritanceTest.chpl:5: note: candidates are: B(type t1)
> Am I doing anything wrong or is there no way to inherit from a generic class?
> Best regards,
> Marco
>
>
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
>
>
>
> _______________________________________________
> Chapel-bugs mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/chapel-bugs
>

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Chapel-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-bugs

Reply via email to