Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Problem with recursive import

Problem with recursive import 24 Apr 2003 14:20 #6476

See the following modules:

module Import_1 {

modulepar {
integer m1, m2;
}

type record r1 {
integer f1,
integer f2
}

template r1 r1_t := { m1, m2 }

}

module Import_1a
{
import from Import_1 recursive {template r1_t};

function t() {
var r1 r;
r := valueof(r1_t);
}

}

The recursive import in module "Import_1a" imports the
template, and the record r1, that is needed to use the template.
So far, so good.

But, if the record r1 is defined in yet another module, how
does recursive import work?

For example:

module Import_2b
{
modulepar {
integer m1, m2;
}

type record r1 {
integer f1,
integer f2
}

}

module Import_2 {

import from Import_2b all;

template r1 r1_t := { m1, m2 }

}

module Import_1a
{
import from Import_2 recursive {template r1_t};

function t() {
var r1 r;
r := valueof(r1_t);
}

}

Should the compiler yield an error message, because the
type r1 is undefined? As I read the standard, it is no very
explicit in how a compiler should be implemented...

Regards,
Matthias Jung

--
Tau Generation2 - Development Visualized. Productivity Realized.
Learn more about Telelogic's new system and software development
solution at: www.taug2.com.


Dr. Matthias Jung
Application Development
Telelogic Deutschland GmbH, Otto-Brenner-Str. 247 , 33604 Bielefeld, Germany
Phone: +49(521)14503-33
Fax: +49(521)14503-50
Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.

Telelogic - Automating the development lifecycle!


The information contained in this e-mail, including any attachment or
enclosure,
is intended only for the person or entity to which it is addressed and may
contain confidential material. Any unauthorised use, review,
retransmissions, dissemination,
copying or other use of this information by persons or entities other than
the
intended recipient is prohibited.

The administrator has disabled public write access.

Problem with recursive import 24 Apr 2003 14:40 #6477

Hi Matthias,

yes, it should report an error. Recursicve import does not span module boundaries. So, even though r1 occurs in the definition of r1_t, it becomes not known by importing r1_t recursively. See clause 7.5.3 NOTE 2 in the standard. This is, by the way, exactly what Telelogic's Tau/Tester implements.

BR

Stephan Tobies

>
Original Message
> From: ext Matthias Jung [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> Sent: 24. April 2003 15:21
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Problem with recursive import
>
>
> See the following modules:
>
> module Import_1 {
>
> modulepar {
> integer m1, m2;
> }
>
> type record r1 {
> integer f1,
> integer f2
> }
>
> template r1 r1_t := { m1, m2 }
>
> }
>
> module Import_1a
> {
> import from Import_1 recursive {template r1_t};
>
> function t() {
> var r1 r;
> r := valueof(r1_t);
> }
>
> }
>
> The recursive import in module "Import_1a" imports the
> template, and the record r1, that is needed to use the template.
> So far, so good.
>
> But, if the record r1 is defined in yet another module, how
> does recursive import work?
>
> For example:
>
> module Import_2b
> {
> modulepar {
> integer m1, m2;
> }
>
> type record r1 {
> integer f1,
> integer f2
> }
>
> }
>
> module Import_2 {
>
> import from Import_2b all;
>
> template r1 r1_t := { m1, m2 }
>
> }
>
> module Import_1a
> {
> import from Import_2 recursive {template r1_t};
>
> function t() {
> var r1 r;
> r := valueof(r1_t);
> }
>
> }
>
> Should the compiler yield an error message, because the
> type r1 is undefined? As I read the standard, it is no very
> explicit in how a compiler should be implemented...
>
> Regards,
> Matthias Jung
>
> --
> Tau Generation2 - Development Visualized. Productivity Realized.
> Learn more about Telelogic's new system and software development
> solution at: www.taug2.com.
>
>
> Dr. Matthias Jung
> Application Development
> Telelogic Deutschland GmbH, Otto-Brenner-Str. 247 , 33604
> Bielefeld, Germany
> Phone: +49(521)14503-33
> Fax: +49(521)14503-50
> Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
>
> Telelogic - Automating the development lifecycle!
>
>
>
> The information contained in this e-mail, including any attachment or
> enclosure,
> is intended only for the person or entity to which it is
> addressed and may
> contain confidential material. Any unauthorised use, review,
> retransmissions, dissemination,
> copying or other use of this information by persons or
> entities other than
> the
> intended recipient is prohibited.
>
>
>
The administrator has disabled public write access.

Problem with recursive import 24 Apr 2003 14:41 #6478

The recursive import only implicitely imports those names that are
defined in the same module (which are used in the 'interface'
of the explicitely imported name).

Thus, if the type of a template is defined in the same module
as the template, it gets imported along with the template, if not,
it doesn't get imported.

Thus, in the second case, if the type isn't imported otherwise
either explicitely or implicitely by another import statement
from the module it is actually defined in, its name cannot be used
and the compiler should yield an error.

Jacob

> See the following modules:
>
> module Import_1 {
>
> modulepar {
> integer m1, m2;
> }
>
> type record r1 {
> integer f1,
> integer f2
> }
>
> template r1 r1_t := { m1, m2 }
>
> }
>
> module Import_1a
> {
> import from Import_1 recursive {template r1_t};
>
> function t() {
> var r1 r;
> r := valueof(r1_t);
> }
>
> }
>
> The recursive import in module "Import_1a" imports the
> template, and the record r1, that is needed to use the template.
> So far, so good.
>
> But, if the record r1 is defined in yet another module, how
> does recursive import work?
>
> For example:
>
> module Import_2b
> {
> modulepar {
> integer m1, m2;
> }
>
> type record r1 {
> integer f1,
> integer f2
> }
>
> }
>
> module Import_2 {
>
> import from Import_2b all;
>
> template r1 r1_t := { m1, m2 }
>
> }
>
> module Import_1a
> {
> import from Import_2 recursive {template r1_t};
>
> function t() {
> var r1 r;
> r := valueof(r1_t);
> }
>
> }
>
> Should the compiler yield an error message, because the
> type r1 is undefined? As I read the standard, it is no very
> explicit in how a compiler should be implemented...
>
> Regards,
> Matthias Jung
>
> --
> Tau Generation2 - Development Visualized. Productivity Realized.
> Learn more about Telelogic's new system and software development
> solution at: www.taug2.com.
>
>
> Dr. Matthias Jung
> Application Development
> Telelogic Deutschland GmbH, Otto-Brenner-Str. 247 , 33604 Bielefeld, Germany
> Phone: +49(521)14503-33
> Fax: +49(521)14503-50
> Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
>
> Telelogic - Automating the development lifecycle!
>
>
>
> The information contained in this e-mail, including any attachment or
> enclosure,
> is intended only for the person or entity to which it is addressed and may
> contain confidential material. Any unauthorised use, review,
> retransmissions, dissemination,
> copying or other use of this information by persons or entities other than
> the
> intended recipient is prohibited.
>
>
>
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin