need clarification about "package import" [message #628073] |
Thu, 19 November 2009 03:54  |
Eclipse User |
|
|
|
Hi all,
after creating a "packageImport" into two packages p1 and p2 each containing a class named "class1" I get no warnings when I validate the model.
Is it normal? I would expect to get a warning to tell me that now two elements have the same name in same namespace (p1 namespace now contains two classes named "class1").
Did I miss something? or is it a bug?
Thanks
raphaël
|
|
|
|
|
Re: need clarification about "package import" [message #628076 is a reply to message #628073] |
Thu, 19 November 2009 07:34  |
Eclipse User |
|
|
|
--=-DCtQdl0gvM9gIFEa58Zg
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hi, Rapha=C3=ABl,
As I understand it, the semantics of package import is to import only
elements of the package that do not clash with names already in the
importing namespace. This effectively ensures that the unique names
constraint cannot be violated by package import: in the extreme case,
the import would not bring in *any* names.
If you use element imports to import the two class1 elements, then the
constraint would be violated. However, with element import you can
assign an alias to give the imported element a distinct name in the
importing namespace.
HTH,
Christian
On Thu, 2009-11-19 at 03:54 -0500, Raphael Faudou wrote:
> Hi all,
> after creating a "packageImport" into two packages p1 and p2 each contain=
ing a class named "class1" I get no warnings when I validate the model.
> Is it normal? I would expect to get a warning to tell me that now two ele=
ments have the same name in same namespace (p1 namespace now contains two c=
lasses named "class1").
>=20
> Did I miss something? or is it a bug?
> Thanks
> rapha=C3=ABl
--=-DCtQdl0gvM9gIFEa58Zg
Content-Type: text/html; charset="utf-8"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Raphaël,<BR>
<BR>
As I understand it, the semantics of package import is to import only elements of the package that do not clash with names already in the importing namespace. This effectively ensures that the unique names constraint cannot be violated by package import: in the extreme case, the import would not bring in *any* names.<BR>
<BR>
If you use element imports to import the two class1 elements, then the constraint would be violated. However, with element import you can assign an alias to give the imported element a distinct name in the importing namespace.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Thu, 2009-11-19 at 03:54 -0500, Raphael Faudou wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi all,
after creating a "packageImport" into two packages p1 and p2 each containing a class named "class1" I get no warnings when I validate the model.
Is it normal? I would expect to get a warning to tell me that now two elements have the same name in same namespace (p1 namespace now contains two classes named "class1").
Did I miss something? or is it a bug?
Thanks
raphaël
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-DCtQdl0gvM9gIFEa58Zg--
|
|
|
Powered by
FUDForum. Page generated in 0.04622 seconds