[BLACKBOX] Exporting records / record fields question

From: [at]} <Chris>
Date: Tue, 27 Jul 2010 11:57:16 +0930

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

A possible anomaly has been reported in the Oberon-07 compiler in our
Astrobe system - it is possible to export a field of a record even though
the record type itself is not exported. I couldn't find a definitive
description of this behaviour in the Oberon-07 language report so I checked
BlackBox to see how Component Pascal handles a similar situation. My
experiment shows that it is also allowed in CP.

For example, in CP I was able to write the following definitions in one
module:

MODULE M;

  TYPE
    T = RECORD (* not exported *)
      x*: INTEGER (* exported *)
    END;
 
  VAR
    v*: T;
  ...
  ...

I was then able to access the exported field in a client module like so:

  M.v.x := 99;

However, when I checked the 'interface' of module M using BlackBox I only
saw:

DEFINITION M;

  VAR
    v: T;

END M.

My questions are:

1. Can you think of any real-world scenarios where this would be useful? If
so what should the 'interface' show?

2. Can you think of any problems / side-effects associated with being able
to do this?

3. Would it be a good thing or a bad thing if a compiler reported an error
if you tried to export a field from a record if the record type itself was
not exported?

Regards,
Chris Burrows
CFB Software

Astrobe: ARM Oberon-07 Development System
http://www.astrobe.com


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1994692265_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmM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iZS5jb21ccGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0KVG8gdW5zdWJz
Y3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JPWCIgdG8gTElT
VFNFUlZATElTVFMuT0JFUk9OLkNIfX0ANjFCQQ==
----boundary-LibPST-iamunique-1994692265_-_---
Received on Tue Jul 27 2010 - 04:27:16 UTC

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