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

TOPIC:

Name clash after import statement 28 Nov 2002 11:52 #6282

Hi,
Could anyone please help me answer the questions below:
Is this code sample semantically correct?
If it is - what is the value of 'dummy' after the assignment - 0 or 1?

Thanks,
Mariusz Jochymczyk

/////////////////////////////////
module b
{
const integer c := 0;
}
/////////////////////////////////
module a
{
type record MyType {integer c};
const MyType b := {1};

import from b all;

control
{
var integer dummy;
dummy := b.c; //0 or 1?
}
}
/////////////////////////////////

Please Log in to join the conversation.

Name clash after import statement 28 Nov 2002 12:25 #6283

Hi Mariusz,

please see below for comments...

Best regards

Stephan Tobies

>
Original Message
> From: ext Jochymczyk Mariusz-AMJ011
> [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> Sent: Donnerstag, 28. November 2002 12:53
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Name clash after import statement
>
>
> Hi,
> Could anyone please help me answer the questions below:
> Is this code sample semantically correct?
> If it is - what is the value of 'dummy' after the assignment - 0 or 1?

Neither, module a won't compile because it contains a semantic error. Then name b cannot be uniquely resolved: it refers both to a local entity and an imported module. This is not allowed, IMO.

If a module can never have the same name as another entity, your problem vanishes.

> Thanks,
> Mariusz Jochymczyk
>
> /////////////////////////////////
> module b
> {
> const integer c := 0;
> }
> /////////////////////////////////
> module a
> {
> type record MyType {integer c};
> const MyType b := {1};

first entity named 'b'

>
> import from b all;

second entity named 'b'

>
> control
> {
> var integer dummy;
> dummy := b.c; //0 or 1?
> }
> }
> /////////////////////////////////
>

Please Log in to join the conversation.

Name clash after import statement 28 Nov 2002 13:57 #6284

Hi,

Stephen is rigth, it will not compile. But it is allowed...

Unfortunately I can not find any requirement saying that the module name shall not clash with any definition name declared inside it... only names WITHIN the scope unit shall be unique (and even more, module is not a scope unit... notice that there are different rules for module identifiers, for example need not be unique). Probably if I'm searching a little bit further...

So, I think, what Stephen says is a possible solution (I would say the best) of the problem but not the status how it is defined in he standard.

Stephen, would you wrigth a CR ? (if I'm rigth and have not skated over something).

Best Regards, György

> dr György RÉTHY
> Manager
> Test Services, Test House, Ericsson Hungary
> Address: H-1037 Budapest, Laborc street 1.
> Phone: + 36 (1) 437-7006
> Mobile: + 36 (30) 297-7862
> Fax: + 36 (1) 437-7767
> Mail-to: This email address is being protected from spambots. You need JavaScript enabled to view it.


>
Original Message
>From: Stephen TOBIES [This email address is being protected from spambots. You need JavaScript enabled to view it.]
>Sent: Thursday, November 28, 2002 1:25 PM
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: Name clash after import statement
>
>
>Hi Mariusz,
>
>please see below for comments...
>
>Best regards
>
>Stephan Tobies
>
>>
Original Message
>> From: ext Jochymczyk Mariusz-AMJ011
>> [This email address is being protected from spambots. You need JavaScript enabled to view it.]
>> Sent: Donnerstag, 28. November 2002 12:53
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: Name clash after import statement
>>
>>
>> Hi,
>> Could anyone please help me answer the questions below:
>> Is this code sample semantically correct?
>> If it is - what is the value of 'dummy' after the assignment
>- 0 or 1?
>
>Neither, module a won't compile because it contains a semantic
>error. Then name b cannot be uniquely resolved: it refers both
>to a local entity and an imported module. This is not allowed, IMO.
>
>If a module can never have the same name as another entity,
>your problem vanishes.
>
>> Thanks,
>> Mariusz Jochymczyk
>>
>> /////////////////////////////////
>> module b
>> {
>> const integer c := 0;
>> }
>> /////////////////////////////////
>> module a
>> {
>> type record MyType {integer c};
>> const MyType b := {1};
>
>first entity named 'b'
>
>>
>> import from b all;
>
>second entity named 'b'
>
>>
>> control
>> {
>> var integer dummy;
>> dummy := b.c; //0 or 1?
>> }
>> }
>> /////////////////////////////////
>>
>

Please Log in to join the conversation.

Name clash after import statement 28 Nov 2002 14:02 #6285

Sure,

If we agree that this should be the solution, then I can write the CR. Are there objections to this solution?

Best regards

Stephan

>
Original Message
> From: ext Gyorgy Rethy (ETH) [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> Sent: Donnerstag, 28. November 2002 14:58
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Name clash after import statement
>
>
> Hi,
>
> Stephen is rigth, it will not compile. But it is allowed...
>
> Unfortunately I can not find any requirement saying that the
> module name shall not clash with any definition name declared
> inside it... only names WITHIN the scope unit shall be unique
> (and even more, module is not a scope unit... notice that
> there are different rules for module identifiers, for example
> need not be unique). Probably if I'm searching a little bit further...
>
> So, I think, what Stephen says is a possible solution (I
> would say the best) of the problem but not the status how it
> is defined in he standard.
>
> Stephen, would you wrigth a CR ? (if I'm rigth and have not
> skated over something).
>
> Best Regards, György
>
> > dr György RÉTHY
> > Manager
> > Test Services, Test House, Ericsson Hungary
> > Address: H-1037 Budapest, Laborc street 1.
> > Phone: + 36 (1) 437-7006
> > Mobile: + 36 (30) 297-7862
> > Fax: + 36 (1) 437-7767
> > Mail-to: This email address is being protected from spambots. You need JavaScript enabled to view it.
>
>
> >
Original Message
> >From: Stephen TOBIES [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> >Sent: Thursday, November 28, 2002 1:25 PM
> >To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> >Subject: Re: Name clash after import statement
> >
> >
> >Hi Mariusz,
> >
> >please see below for comments...
> >
> >Best regards
> >
> >Stephan Tobies
> >
> >>
Original Message
> >> From: ext Jochymczyk Mariusz-AMJ011
> >> [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> >> Sent: Donnerstag, 28. November 2002 12:53
> >> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> >> Subject: Name clash after import statement
> >>
> >>
> >> Hi,
> >> Could anyone please help me answer the questions below:
> >> Is this code sample semantically correct?
> >> If it is - what is the value of 'dummy' after the assignment
> >- 0 or 1?
> >
> >Neither, module a won't compile because it contains a semantic
> >error. Then name b cannot be uniquely resolved: it refers both
> >to a local entity and an imported module. This is not allowed, IMO.
> >
> >If a module can never have the same name as another entity,
> >your problem vanishes.
> >
> >> Thanks,
> >> Mariusz Jochymczyk
> >>
> >> /////////////////////////////////
> >> module b
> >> {
> >> const integer c := 0;
> >> }
> >> /////////////////////////////////
> >> module a
> >> {
> >> type record MyType {integer c};
> >> const MyType b := {1};
> >
> >first entity named 'b'
> >
> >>
> >> import from b all;
> >
> >second entity named 'b'
> >
> >>
> >> control
> >> {
> >> var integer dummy;
> >> dummy := b.c; //0 or 1?
> >> }
> >> }
> >> /////////////////////////////////
> >>
> >
>

Please Log in to join the conversation.

  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin