SSEHUB / EASyProducer

EASy-Producer - A Product Line Engineering Toolset
Apache License 2.0
10 stars 2 forks source link

IVML-Parser: Transparent handling of references does not work (parameters are not compliant) #72

Closed Elscha closed 6 years ago

Elscha commented 8 years ago

Collections operating on references and collections operating on the refered type are not compliant, e.g., situations like :

project IVML {

    version v0;
    sequenceOf(String) strs1;
    sequenceOf(refTo(String)) strs2;

    strs1 == strs2;
}

are rather hard to handle.

CC: @eichelbe

eichelbe commented 8 years ago

So far not defined by the IVML language specification, or?

Elscha commented 8 years ago

There is nothing defined for such situations. In some cases it works, in other not. As there is no clearly defined unpack function, I do not know how to make such collections compareable.

eichelbe commented 8 years ago

apply over individual elements does not help?

Elscha commented 8 years ago

This problem would be solveable if at least #74 would work. However, the handling would not be very pretty :confused:

Elscha commented 8 years ago

Also

project IVML {

    version v0;
    sequenceOf(String) strs1;
    sequenceOf(refTo(String)) strs2;

    strs2->apply(refTo(String) s, setOf(String) set = {} | set.add(s));
}

does not help.

eichelbe commented 8 years ago

why should this help, this is not a comparison

Elscha commented 8 years ago

OK, that seems to work:

project IVML {

    version v0;
    setOf(String) strs1;
    setOf(refTo(String)) strs2;

    strs1 = strs2->apply(refTo(String) s; setOf(String) set = {} | set.add(refBy(s)));
}

However, the IVML Language Specification must be updated, as a comma is used to separate both parameter inside the apply instead of the semicolon

eichelbe commented 8 years ago

Fine. There shall be an updated description of apply, in particular for temporary declarators. Could you please check and, if require, update the spec?

Elscha commented 8 years ago

Yes, I will do that.

Elscha commented 8 years ago

Fixed the IVML Language Specification. However, the reasoner does not consider such constraints. In both models, the reasoner will detect no errors (only the second one should be valid):

project IVML {

    version v0;
    sequenceOf(String) array = {"Hello", " ", "World"};
    setOf(refTo(String)) referedVars = {refBy(array[0]), refBy(array[2])};
    setOf(String) orgVars;

    referedVars->apply(refTo(String) itr;
      setOf(String) tmpValues = {} | tmpValues.add(refBy(itr))).size() == 1;
}
project IVML {

    version v0;
    sequenceOf(String) array = {"Hello", " ", "World"};
    setOf(refTo(String)) referedVars = {refBy(array[0]), refBy(array[2])};
    setOf(String) orgVars;

    referedVars->apply(refTo(String) itr;
      setOf(String) tmpValues = {} | tmpValues.add(refBy(itr))).size() == 2;
}

Also in this case, no value will be assigned to orgVars, even if this may be ok as it is questionable wehther a permanent assignment should be poosible:

project IVML {

    version v0;
    sequenceOf(String) array = {"Hello", " ", "World"};
    setOf(refTo(String)) referedVars = {refBy(array[0]), refBy(array[2])};
    setOf(String) orgVars;

    // "Derefer" values
    orgVars = referedVars->apply(refTo(String) itr;
      setOf(String) tmpValues = {} | tmpValues.add(refBy(itr)));
}
eichelbe commented 8 years ago

Hi,

warum sollte in den ersten zwei Fällen was assigned werden - und was tut der reasoner da? Beim dritten sollte was passieren, liegt ggf. aber am EvaluationVisitor. Also sollten wir das erst mal prüfen. Kannst du aus dem dritten einen Testcase machen?

Viele Grüße, Holger

Elscha commented 8 years ago

Hallo Holger,

bei den ersten beiden Fällen erstelle ich mittels des applys eine temporäre Liste, deren Länge ich überprüfe. Nach meinem Verständnis sollte die Läge 2 sein, womit im ersten Fall ein Fehler gefunden werden müsste. Ist für den dritten Fall tatsächlich das Assignment gewünscht (hatten wir ja gestern drüber gesprochen)? Dann kann ich den Testfall erstellen.

Mit freundlichen Grüßen Sascha El-Sharkawy

Elscha commented 8 years ago

Found the failure in:

The error occurs if a reference value (for aValue) is added to a container, which is not operating on references. I'm not realy sure how to handle it without breaking something else.

eichelbe commented 6 years ago

Original post: IVML parser correctly complains about type inequality ("he types of all parameters of operation '==' need to be compliant"). IVML design having explicit type operations for references requires in this situation refBy(.). New version of IVML to be committed warns about potential comparison flaws for unequal types (inspired by this issue).

eichelbe commented 6 years ago

Examples from 18 Jul 2016: Actual version of IVML reasoner handles these situations as expected. Commit for respective test cases will follow.