Re: [BLACKBOX] Matrix slices - syntax

From: [at]} <Aubrey>
Date: Thu, 1 Apr 2010 01:00:31 -0500

----boundary-LibPST-iamunique-547322232_-_-
Content-type: text/plain

Try this:
MODULE PrivTest2;

TYPE
 VDesc = ARRAY OF REAL;
 V3Desc = ARRAY 3 OF REAL;
 MDesc = ARRAY OF ARRAY OF REAL;
 M3Desc = ARRAY 3,3 OF REAL;
 MTubeDesc = ARRAY 3 OF V3Desc;

  PROCEDURE Q (IN v: VDesc); BEGIN END Q;
  PROCEDURE Q3 (IN v: V3Desc); BEGIN END Q3;

  PROCEDURE Test;
  VAR
        mt : MTubeDesc;
        
  BEGIN
    Q(mt[0]); (* works *)
        Q3 (mt[0]) (*also works*)
  END Test;

END PrivTest2.



On Wed, Mar 31, 2010 at 9:23 PM, Douglas G. Danforth
<danforth{([at]})nowhere.xy
> Folks,
>
> I don't understand this.
> If I define a procedure that takes an ARRAY OF REAL and
> pass it an row of a matrix then that works BUT if I specialize
> the procedure to take an ARRAY 3 OF REAL and pass it a
> row of a matrix ARRAY 3,3 OF REAL then the compiler complains.
>
> TYPE
>  VDesc = ARRAY OF REAL;
>  V3Desc = ARRAY 3 OF REAL;
>  MDesc = ARRAY OF ARRAY OF REAL;
>  M3Desc = ARRAY 3,3 OF REAL;
>
>   PROCEDURE Q (IN v: VDesc); BEGIN END Q;
>   PROCEDURE Q3 (IN v: V3Desc); BEGIN END Q3;
>
>   PROCEDURE Test;
>   VAR m3: M3Desc;
>   BEGIN
>     Q(m3[0]);  (* works *)
>     Q3(m3[0])  (* fails! incompatible assignment *)
>   END Test;
>
> The "slice" m3[0], which is the first row of m3, is accepted by a routine
> that accepts general non specific vectors but that same slice which
> has length 3 is rejected by a routine that wants vectors of length 3.
> Why?
> I really don't understand the strong typing in this case.
>
> -Doug Danforth
>
>
> ---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
> LISTSERV{([at]})nowhere.xy



-- 
-- 
Aubrey McIntosh, Ph.D.
1502 Devon Circle
Austin TX 78723-1814
http://home.grandecom.net/~amcintosh/aubrey/Search/
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-547322232_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBUcnkgdGhpczpccGFyDQpNT0RV
TEUgUHJpdlRlc3QyO1xwYXINClxwYXINClRZUEVccGFyDQogVkRlc2MgPSBBUlJBWSBPRiBSRUFM
O1xwYXINCiBWM0Rlc2MgPSBBUlJBWSAzIE9GIFJFQUw7XHBhcg0KIE1EZXNjID0gQVJSQVkgT0Yg
QVJSQVkgT0YgUkVBTDtccGFyDQogTTNEZXNjID0gQVJSQVkgMywzIE9GIFJFQUw7XHBhcg0KIE1U
dWJlRGVzYyA9IEFSUkFZIDMgT0YgVjNEZXNjO1xwYXINClxwYXINCiAgUFJPQ0VEVVJFIFEgKElO
IHY6IFZEZXNjKTsgQkVHSU4gRU5EIFE7XHBhcg0KICBQUk9DRURVUkUgUTMgKElOIHY6IFYzRGVz
Yyk7IEJFR0lOIEVORCBRMztccGFyDQpccGFyDQogIFBST0NFRFVSRSBUZXN0O1xwYXINCiAgVkFS
XHBhcg0KXHRhYiBtdCA6IE1UdWJlRGVzYztccGFyDQpcdGFiIFxwY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S0g
XHBhcg0KLS0gXHBhcg0KQXVicmV5IE1jSW50b3NoLCBQaC5ELlxwYXINCjE1MDIgRGV2b24gQ2ly
Y2xlXHBhcg0KQXVzdGluIFRYIDc4NzIzLTE4MTRccGFyDQpodHRwOi8vaG9tZS5ncmFuZGVjb20u
bmV0L35hbWNpbnRvc2gvYXVicmV5L1NlYXJjaC9ccGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0K
VG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JP
WCIgdG8gTElTVFNFUlZATElTVFMuT319AApMaXN0LVN1YnNjcg=
----boundary-LibPST-iamunique-547322232_-_---
Received on Thu Apr 01 2010 - 08:00:31 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:34 UTC