Re: AW: puzzle

From: René A. Krywult <"René>
Date: Tue, 13 Apr 2004 16:52:51 +0200 (DFT)

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

I don't know. I tried the example as provided by Fyodor, and it sure was compileable (in BB 1.3).

Also, the language report says:

"if T is an n-dimensional open array type the allocation has to be done with NEW(p, e0, ..., en-1) where T is allocated with lengths given by the expressions e0, ..., en-1."

>From this I would follow that Fyodor's example is valid.

The real problem arouse, when I hit the commander several times: The trap does not occur each time the procedure is executed!

Rene

=============René A. Krywult
-------------------------------------------------
Lege, lege, relege, ora, labora et invenies
___________________________________



----- Original von: cpc <cpc{([at]})nowhere.xy

> Dear Fyodor,

the reason is that both variable (a & p) are not assign compatible.

It is not allow to declare an open variable

        VAR x: ARRAY OF ARRAY OF CHAR;
so
        VAR p: POINTER TO ARRAY OF ARRAY OF CHAR;
should be rise an compiling error too. (???)

Here sample which works:

MODULE PrivPuzzle;
        IMPORT StdLog;
        
        PROCEDURE Do*;
                CONST
                        str = '0123';
                        len = LEN( str );
                TYPE
                        T = ARRAY 1, len + 1 OF CHAR;
                VAR
                        a: T;
                        p: POINTER TO T;
        BEGIN
                a[0] := str;
                NEW( p );
                StdLog.Int( LEN( str ) ); StdLog.Int( LEN( p[0] ) );
StdLog.Ln;
                ASSERT( LEN( str ) < LEN( p[0] ) ); (* Language Report,
9.1, 3. *)
                p[0] := str (* now it works ! *)
        END Do;

END PrivPuzzle.

(!) PrivPuzzle.Do

Regards

Helmut Zinn



      \|||/
      (o o)
---ooO-(_)-Ooo------

---
Have a look at http://www.zinnamturm.de
Send your answer and comments to mailto:cpc{([at]})nowhere.xy-----Ursprüngliche Nachricht-----
Von: Fyodor Tkachov [mailto:fyodor.tkachov{([at]})nowhere.xyGesendet: Montag, 12. April 2004 20:52
An: Blackbox Mailing-List
Betreff: puzzle
Dear Experts:
I am puzzled by the attached module.
If p[0] is not ARRAY len + 1 OF CHAR then what the hell is it?
(May be I am in need of a good long rest after the Oberon Day...)
Many thanks in advance,
Fyodor Tkachov
------------------------------------------
MODULE  PrivPuzzle;
	IMPORT  StdLog;
	
	PROCEDURE Do*;
		CONST 
			str = '0123';
			len = LEN( str );
		VAR 
			a: ARRAY 1, len + 1 OF CHAR;
			p: POINTER TO ARRAY OF ARRAY OF CHAR;
	BEGIN
		a[0] := str;
		NEW( p, 1, len + 1 );
		StdLog.Int( LEN( str ) );  StdLog.Int( LEN( p[0] ) );
StdLog.Ln;
		ASSERT( LEN( str ) < LEN( p[0] ) );  (* Language Report,
9.1, 3. *)
		p[0] := str   (* Trap: string too long -- for anything
longer than empty string! *)
	END Do;
END  PrivPuzzle.
(!)PrivPuzzle.Do
Powered by the E-mail PIM - Info Select - www.miclog.com
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word
"unsubscribe" to:
   blackbox-request{([at]})nowhere.xyTo get a list of valid e-mail commands and instructions on their usage, send
a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list
owner at
   owner-blackbox{([at]})nowhere.xyCurrent posting policy:
a) To post you should use the same address by which you are subscribed to
the mailing list. That way, the list server will recognize you as subscriber
and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are
subscribed, your message will be moderated to avoid spam. Please understand
that moderation will often cause some delay, in particular over weekends or
holydays.
-------------------------------------------
Versendet durch AonWebmail (webmail.aon.at)
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xyTo get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xyCurrent posting policy:
a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
----boundary-LibPST-iamunique-1522413358_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-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pYmVyIGFuZCBmb3J3YXJkIHlvdXIgcG9zdGluZyBpbW1lZGlhdGVseSwgd2l0
aG91dCBjcmVhdGluZyBhbnkgb3ZlcmhlYWQuXHBhcg0KXHBhcg0KYikgSWYsIGZvciBzb21lIHJl
YXNvbiwgeW91IGNhbm5vdCBwb3N0IGZyb20gdGhlIGFkZHJlc3MsIGJ5IHdoaWNoIHlvdSBhcmUg
c3Vic2NyaWJlZCwgeW91ciBtZXNzYWdlIHdpbGwgYmUgbW9kZXJhdGVkIHRvIGF2b2lkIHNwYW0u
IFBsZWFzZSB1bmRlcnN0YW5kIHRoYXQgbW9kZXJhdGlvbiB3aWxsIG9mdGVuIGNhdXNlIHNvbWUg
ZGVsYXksIGluIHBhcnRpY3VsYXIgb3ZlciB3ZWVrZW5kcyBvciBob2x5ZGF5cy5ccGFyDQpccGFy
DQp9
----boundary-LibPST-iamunique-1522413358_-_---
Received on Tue Apr 13 2004 - 16:52:51 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:28:47 UTC