SDL-News: Re: create statement


Subject: SDL-News: Re: create statement
From: Rick Reed TSE (rickreed#tseng.co.uk)
Date: Fri Apr 04 2003 - 22:18:14 GMT


Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews -----

Eckhardt Holz at holz#informatik.hu-berlin.de wrote on 04/04/2003 11:48:

> 2. A contained agent creates a new instance of an agent which is
> contained in the same agent as the creator. In this case the <create
> body> is again an agent identifier which refers to an <agent
> definition>. The creator and the addressed <agent definition> are
> directly contained in the same container agent. The agent set may be the
> same set the creator belongs to (e.g. by using "create this") or an
> other agent set directly contained in the same agent as the creator.
> In other words, an agent can create its neighbours.

While Eckhardt is correct that the identified agent set can be a neighbour,
this does not have to be the case. From Z.100(08/02):

"The create action causes the creation of an instance of the set identified
by Agent-identifier either inside the agent that performs the create or in
an agent that contains the agent that performs the create."

[[BTW: It seems the Roger is not using the latest version of Z.100, as he
quotes section 11.13.2 (Create) of Z.100 as:

  "The create action causes the creation of an agent instance
                      either inside the agent that performs create or in
   the agent that contains the agent that performs the create".]]

It is only required that the identified agent instance set is in "an agent"
the contains the agent the performs the create. Any containing agent will
do. Essentially it just means that the instance set has to be visible to the
creator.

Eckhardt's examples are therefore not quite correct:

> SYSTEM ex1;
> BLOCK A;
> BLOCK B; ... ENDBLOCK B;
> BLOCK C; ... ENDBLOCK C;
> ENDBLOCK A;
> BLOCK D;
> ...
> ENDBLOCK D;
> ENDSYSTEM ex1;
>
> in this case
> A may create instances of A (this), B, C and D;
> B may create instances of B and C
B may also create instances of A and D
> C may create instances of B and C
C may also create instances of A and D
> D may create instances of D and A
>
> The creation of an A instance may implicitly lead to the creation of B
> and C instances if there initial numbers are non-zero.
>
> If we change the example to use agent type definitions there are
> different possibilities to create instances:
>
> SYSTEM ex2;
> BLOCK TYPE A;
> BLOCK B; ... ENDBLOCK B;
> BLOCK C; ... ENDBLOCK C;
> ENDBLOCK TYPE A;
> BLOCK TYPE D;
> ...
> ENDBLOCK TYPE D;
> BLOCK A_Inst : A;
> BLOCK D_Inst : D;
> ENDSYSTEM ex2;
>
> now we have
> A may create A, B, C, D and A_Inst and D_Inst
  ^ A can't create anything. It is a type (not an instance).
               ^ ^ A and D are types not instances and therefore
cannot be created.
A_Inst instances can create A_Inst, B, C or D_Inst instances
> The instances of the "Create A" will be added to
> the A_Inst set (for D similar)
It depends where the "Create A" is.
This is correct if the create A is within the state machine of TYPE A or
TYPE D.
If the "Create A" is within B or C, a neighbour within the instance of A is
created (in a new instance set within an instance of Type A if necessary).
Note that this then has instances of B and C within it and so further
nesting of instance of type A is possible!!!
[[Aside: this is what Z.100 currently says - though I am not sure this is
what we intended. Maybe Z.100 should be reworded to avoid the creation of
nested instances in this way.
I suggest in the Model (a) that "the agent containing the instance" should
be "an agent containing the instance" so that another A_Inst instance is
created.]]

> D may create A, D A_Inst and B_Inst
D can't create anything. It is a type (not an instance).
A and D are types not instances and therefore cannot be created.
Create A (or D) in D_Inst creates an instance of A in the A_Inst set (D in
the D_Inst set - resepctively).
D_inst can create A_inst and D_Inst (I assume B_Inst was a typo).

> B and C may create B, C, A and D
B and C (instances) can create additional instances in B and C, and
instances of A and D.
> In case of A and D two implicit agent sets will be
> created in A_Inst
> We would obtain the same behaviour if the block A_Inst would
> have the name A (and similar for B).
>
> Now an example with a very slight change
> SYSTEM ex3;
> BLOCK TYPE A;
> BLOCK B; ... ENDBLOCK B;
> BLOCK C; ... ENDBLOCK C;
> ENDBLOCK TYPE A;
> BLOCK TYPE D;
> ...
> ENDBLOCK TYPE D;
> BLOCK A_Inst : A; // !!!
> BLOCK A : D; //!!!
> ENDSYSTEM ex3;
>
> now we get:
> A may create A, B, C, D and A_Inst:
An instance of the set A may create a instance of the type A or D in the set
A_Inst or A respectively.
> create A produces a new instance of D in set A
> create this produces a new instance of Type A in
> set A_Inst
This is correct for create this in A_Inst,
but for an instance of the set A it is my opinion that "create this" creates
an another instance in the set A.
However, I think the example is illegal because a tyoe and instance set with
the same name leads to two implicit interface definitions with the same
name. If this is correct the paragraph in Z.100 about the names being the
same is not needed.
> (create <<ex4>> BLOCK TYPE A does the same)
> create B and C work as before
> create D produces a new instance of D in set A
"create D" where?
> create A_Inst produces a new instance of Type A in
> set A_Inst
> D may create A, D and A_Inst
D may contain create A, create D or create A_Inst
> create A produces an D
> create D produces an D
> create this produces an D
> create A_Inst produces an A
>
> my final example is again a modification of ex1:
>
> SYSTEM ex4;
> BLOCK A;
> BLOCK B; ... ENDBLOCK B;
> BLOCK C; ... ENDBLOCK C;
> BLOCK D; ... ENDBLOCK D;
> ENDBLOCK A;
> BLOCK D;
> ...
> ENDBLOCK D;
> ENDSYSTEM ex4;
>
> in this case
> A may create instances of A (this), B, C the contained D;
> To create an instance of the external D A must use
> the qualified name <<ex4>> D
> B may create instances of B, C and the D in A
> C may create instances of B, C and the D in A
> contained D create instances of B, C and the D in A
> external D may create instances of (external) D and A

     

--
Rick Reed - rickreed#tseng.co.uk
Tel:+44 15394 88462 Mob.:+44 7970 50 96 50

--End text from Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews --- For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>



This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT