Hi Weekend Workers,
I copied the Wrapper record and tried to include an array of size known at
compile time. I am after a value type which does not need 'new'. Ideally
this should all come off the stack but Chapel seems to shy away from the
stack. But that is another question.
For now, I just want to stuff an array into a generic record which works
for any sized array. This is a 'finite element' which has a connectivity
vector full of integers, which are node numbers.
type a6 = [1..6] int;
record element
{
type T;
var data : T;
proc init=(other : this.type.T)
{
this.T = other.type;
this.data = other;
}
}
proc main
{
var x : [1..6] int = [ 1, 2, 3, 4, 5, 6 ];
var t = element(x);
writeln(t);
}
The above is rejected with
v.chpl:15: In function 'main':
v.chpl:18: error: invalid type specifier 'element([domain(1,int(64),false)]
int(64))'
v.chpl:18: note: type specifier did not match: element(type T)
v.chpl:18: note: cannot instantiate type field 'T' with non-type
What am I missing in this generic record?
The type of x is '[1..6] int'.
Is the type of an array really not a type in the strict sense?
Thanks - Damian
Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers