Hi Russell,

I believe some of this was answered in another thread, but for completeness:

>Are there ways of constructing zero length arrays?

Yes, e.g.,

var A: [1..0] int;


>Are there ways of constructing and returning tuples of length only
>known at run-time?

No. The length of a tuple must be a compile-time known constant. See section 14 
in the language specification [1] for more details. A relevant excerpt:

"""
Homogeneous tuples require the size to be specified as a parameter (a 
compile-time constant).
This avoids any overhead associated with storing the runtime size in the tuple. 
It also avoids the question
as to whether a non-parameter size should be part of the type of the tuple.  If 
a programmer requires a
non-parameter value to define a data structure, an array may be a better choice
"""

[1] http://chapel.cray.com/docs/latest/_downloads/chapelLanguageSpec.pdf#104

Best,
Ben


------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to