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

TOPIC: Field attributes overwriting rules

Field attributes overwriting rules 17 Jul 2012 14:01 #7800

Hi,

I have a question related to overwriting rules of attributes.

We have following example:
module M {
type T1 {
integer x
} with {
extension "T1"
}

type T2 {
T1 t,
integer x
} with {
extension (T2.t) "T2.t"
}
}

What is the extension attribute of T2.t? Does field attribute overwrite
type attributes by default or only when attribute is defined with
override keyword?


By the way, is any of these attributes definitions allowed:
module M {
group G {
type T1 {
integer x
}
type T2 {
T1 t
}
}
} with {
extension (G.T2) "G.T2"
extension (G.T2.t) "G.T2.t"
extension (G.T2.t.x) "G.T2.t.x"
}


Regards!
Bartosz Kalinczuk
The administrator has disabled public write access.

Field attributes overwriting rules 19 Jul 2012 08:03 #7801

Hi all,

Ok, what I found out is that apparently defining attributes of field of
type, that is external to the opaque type,
was not possible before it was possible to reference types by field.
The question is if it is possible now, as in example below.

Another thing I was told, is that defining attributes by group
identifier is not possible.
Does it mean, that this is also not possible:
module M
{
group G {}
} with { extension (G) "ext" }


Could anyone help me figuring this out?


Btw. I forgot to add record keywords in example below:

On 07/17/2012 04:01 PM, ext Bartosz Kalinczuk wrote:
> Hi,
>
> I have a question related to overwriting rules of attributes.
>
> We have following example:
> module M {
> type record T1 {
> integer x
> } with {
> extension "T1"
> }
>
> type record T2 {
> T1 t,
> integer x
> } with {
> extension (T2.t) "T2.t"
> }
> }
>
> What is the extension attribute of T2.t? Does field attribute
> overwrite type attributes by default or only when attribute is defined
> with override keyword?
>
>
> By the way, is any of these attributes definitions allowed:
> module M {
> group G {
> type record T1 {
> integer x
> }
> type record T2 {
> T1 t
> }
> }
> } with {
> extension (G.T2) "G.T2"
> extension (G.T2.t) "G.T2.t"
> extension (G.T2.t.x) "G.T2.t.x"
> }
>
>
> Regards!
> Bartosz Kalinczuk
The administrator has disabled public write access.

Field attributes overwriting rules 23 Jul 2012 09:45 #7802

Hello,
it doesn't make me wonder that somebody gets confused with attribute
handling. Despite of some corrections and refinements of the original
version there are still some things which remain unclear to me.
E.g. it is specified that

type record R {
integer f1,
R2 f2
} with {
extension (f2) "R2.f2"
extension "forRecordR"
}

will apply the extension attribute "forRecordR" to R and recursively to
f1. For f2 "R2.f2" will be applied.
Though it is nowhere specified whether "R2.f2" will be applied too if
there is an extension attribute already attached at the definition of R2
(all examples in chapter 27 omit this possibility and attach attributes
only to fields of predefined types):

type record R2 {
boolean f21
} with {
extension "forR2"
}

It is also not clear whether we could write something like
...
extension f2.f21 "otherValueForR2.f21"
...
attached to the definition of R, or whether such deeply nested field
references are only intended to be used on nested type definitions.
From the Restriction part of paragraph 27.2

"a) DefinitionRef and FieldReference must refer to a definition or field
respectively which is within the module,
group or definition to which the with statement is associated."

I would say that my latter assumption is correct - but as I am not a
native speaker I have some difficulties with this sentence :-).
In my opinion this sentence should be rewritten into:

"DefinitionRef must refer to a definition which is within the module or
group to which the with statement is associated.
FieldReference must refer to a field which is within the definition to
which the with statement is associated."

This would make it clearer that accessing fields from module or group
level is not allowed, e.g.

module M {
type record R2 {
boolean f21
}
} with {
extension (R2.f21) "someAttrib"
}

@Bartosz:

module M
{
group G {
type record of integer RoI;
}
} with { extension (G) "ext" }

I would say this is definitely allowed. Referencing G.RoI is definitely
not allowed as one can't use group names for qualification of types.
Referencing RoI[-] from module or group level remains to be clarified.

BR.,
Uwe
Last Edit: 15 Jul 2013 08:14 by Silvia Almagia.
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin