I have just spent time debugging some OO C routines, some C++ classes, and some Java classes.
So my brain was going to appreciate clear and concise error messages.
I was trying to debug something along the lines of this
class minBase
{
param zero = 0:real;
var a = zero;
var b = zero;
proc init(lo : R, hi : R)
{
(a, b) = if lo < hi then (lo, hi) else (hi, lo);
}
proc show()
{
writeln("a = ", a);
writeln("b = ", b);
}
}
The error message you get from the init routine is very vague, i.e.
t.chpl:36: In initializer:
t.chpl:38: error: field "a" used before it is initialized
t.chpl:38: error: field "b" used before it is initialized
So I thought, maybe a tuples works in reverse so I changed the ordering to use
(b, a)
Well, same error.
My question is - what ordering does a tuple imply? The error needs to talk about Out of Order initialization because clearly, "a" and "b" are not used before they are initialized.
Note that one fix is
const (_a, _b) = if lo < hi then (lo, hi) else (hi, lo);
a = lo;
b = hi;
This is a problem. Does it exist 1.25.1. Unfortunately, I cannot upgrade for a while yet.
Trying to define a class here with a finite state machine.
class minBracket1D
{
.....
enum state { commence, done, interior, exterior, golden, curbed };
// OK, so I define my **enum**s and use one of them to initiialize `s`
var s = state.commence;
.....
proc init(...parameters); // this is line 145
m2.chpl:145: internal error: UTI-MIS-0691 chpl version 1.22.0
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 IU Webmaster redirect for instructions. In the meantime,
the filename + line number above may be useful in working around the issue.