Hi Damian --

I'm heading for the door, but wanted to attempt to get a response into 
your hands before the day was through:

> // this fails <-----------------!!!!!!
> // proc testOfTuple1(b : (int(16), int(16), int(?w))) : real(w)

I believe this ought to work and am _slightly_ surprised it does not. That 
said, as I've mentioned on another thread recently, our wildcard formal 
argument pattern matching support is a bit piecemeal at present and needs 
to be beefed up, so I'd guess that's what you're hitting.  A wildcard-free 
way to handle this case _may_ be (sorry I don't have time to test):

        proc testOfTuple(b ...): real(numBits(b(3).type))

Ugly, though...  For this reason, I might tend to use the more 
type-inferred version and create 'chpldoc' comments to describe what's 
expected (but there are good reasons to want the more explicitly typed 
form as well, so I'm not suggesting that's a solution for all cases).



>       var w : int;
...
>       w = numBits(b(3).type);
...
>       // this fails <-----------------!!!!!!
>       // return (e * m):real(w);

Here, the issue is much simpler: the argument to real() must be a param 
(compile-time known value).  Happily, numBits() returns a param, so the 
fix should simply be:

        param w: int = numBits(b(3).type);
        return (e * m): real(w);

or simply:

        return (e * m): real(numBits(b(3).type));

Hope this is helpful...

-Brad

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

Reply via email to