On Sat, 2016-09-03 at 21:10 +0000, Mike Noakes wrote:
> Hi Russel,
>
> The “trick” is to know that the range 1 .. 0 is the canonical empty
> range (one of
> many of course). So then
>
> >
> > cat foo.chpl
> proc main() {
> var empty : [1 .. 0] real;
>
> writeln('numElements: ', empty.numElements);
> }Every programming language has it's truly "icky" bits that cannot be fixed without making things worse. I wonder if this is one of Chapel's icky bits. Clearly the index range 1..0 is, using Python style semantics (e.g. something[1:0]), an empty range. I am assuming that this is needed to deal with use of variables as low and high limit, e.g. x..y. I wonder though that given 0 is not a legal index, the type of the array of zero length could be denoted [0] real, but then that may ruin the consistency of the idea of a range and it's use. However the second reason for the error report was not so much what to do as a workaround (now dealt with, thanks), but… > > > > > chpl -o foo foo.chpl > > > > > > > ./foo > numElements: 0 > > > Regards, > > Mike > > > > > > > > On Sep 3, 2016, at 9:49 AM, Russel Winder <[email protected]> > > wrote: > > > > In trying to define an empty, zero length array, I tried the > > program: > > > > proc main() { > > const emptyArray: [?] real; > > } > > > > but it gave me the error: > > > > > > > > > > > > > chpl incorrectArrayDeclaration.chpl > > incorrectArrayDeclaration.chpl:2: internal error: CAL0057 chpl > > Version 1.13.1.8b51523 > > Note: This source location is a guess. > > > > Internal errors indicate a bug in the Chapel compiler ("It's us, > > not you"), > > and we're sorry for the hassle. We would appreciate your reporting > > this bug -- > > please see http://chapel.cray.com/bugs.html for instructions. In > > the meantime, > > the filename + line number above may be useful in working around > > the issue. …the error report clearly indicates a bug in the compiler. An expression that is valid in parameter position is causing internal problem in a situation where it is not a valid syntax. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected] 41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected] London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------
_______________________________________________ Chapel-bugs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-bugs
