Hi Michael,

Thanks for the quick response!  Answers to your answers -

Michael Ferguson wrote:
> Hi Greg -
>
> See below...
>>
>> 1. Is it possible to have the select statement warn or raise
>>     an error if all the members of an enum aren't handled?
>
> I (personally) think that it should do that. It's probably worth
> double-checking that it doesn't and filing a bug (or feature request)
> in our test system. See below...
>

It does not.  I just tried a simple test case with only half the
enum elements in a select.  It compiled cleanly and ran; if the
value passed to the select wasn't one of those with a 'when' clause
then it was ignored silently (the behavior we'd like to avoid).

I'll get set up to submit a test case.

>>
>> 2. Why does the select .. otherwise case only allow a single
>>     statement?  (We've had to use an if..then chain a few times
>>     because of this.)
>
> Are you using curly braces within the otherwise block? This program
> works for me as I would expect:
>
> config const x = 1;
>
> select x {
>    when 1 {
>      writeln("found 1");
>      writeln("yay!");
>    }
>    otherwise {
>      writeln("found something else");
>      writeln("the value found was ", x);
>    }
> }
>
>

Ah, no, we weren't actually brave enough to try this; the comment was
based on the spec (p. 77) which only lists a single statement as
permitted, not a block.

>>
>> 3. Can you access the size of a tuple with a query?  Something
>>     like
>>       proc p(pt : ?ndim * int) {
>>         writeln("dimensionality of point is ", ndim);
>>       }
>>     doesn't compile with the message "syntax error: near '*'".
>
> Sounds like a bug (or at least future work). I don't think there's
> any reason we wouldn't support such things. In the mean time, you
> can use pt.size if you know that pt is a tuple...
>
> I believe you could write the equivalent thing with something like
>        proc p(pt : ?t ) where isHomogeneousTuple(t)  && t(1).type == int
> {...}
>
> although I haven't checked that compiles...
>

Yeah, we fixed this with a param to the class.  It just would have
been nice not to have to specify it in the constructor and have
a generic piece of code figure it out for itself.

>> 4. Does a domain slice form a subdomain?  It's not clear in the
>>     spec.
>
> I'm going to let somebody else answer that one.
>
>> 5. Are constants in a class only accessible from an instance
>>     (which the spec seems to say is the case)?  We were looking
>>     for something like a static class member in Java, but there
>>     was an instance available in the code at that point to get
>>     the constant values.
>
> Right now we don't have anything equivalent to Java's static class
> members. I (personally) think it would be nice to add at some point.
> Can you use a global in your situation?

Not needed, there was an instance available.  This was for a test
bench where we wanted to check the return value of a method).

>
> BTW, if you are going to have a long list of these requests, it
> would probably be best if you can file them in our testing system
> yourself. The outline of what you would need to do:
>   * sign a contributor agreement (see
> http://chapel.cray.com/developers.html)
>   * create e.g. mytest.chpl and mytest.good with the expected output,
>     along with mytest.future explaining what you're requesting/what
>     isn't working now.
>   * use util/start_test to verify that your tests run as expected
>     (which probably means that they are "failing futures")

Which is a very nice system you've integrated into the distribution,
once you realize that all the code snippets are actually exectuble
for the test suite!

>   * create a pull request for the GitHub project with these cases
>
> It still makes sense to bring them up on a mailing list for
> discussion in any case.
>

Will do.  It may take a day or two until we can get things submitted.

Greg

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to