Skip to contentSkip to conversation

Logical consequences for applications of SmPL conjunctions

cocci Markus Elfring 2 participants 6 messages Mar 29 – Apr 1

lore
Share & tools
lore
#0 lore raw

Hello,

The functionality “conjunctions” became supported for the semantic patch language by the contribution “completing the implementation of conjunction” on 2015-08-25.
https://gitlab.inria.fr/coccinelle/coccinelle/-/commit/4069c543b25c819552eb080c849079f35f60a12e

The software documentation was extended by the contribution “some doc on disjunctions” on 2015-10-30.
https://gitlab.inria.fr/coccinelle/coccinelle/-/commit/48a6dd0aef1d233c8d2cf841aafedb1bf28cafb0

Are involved subterms as often evaluated as they are specified for such SmPL conjunctions?

Regards,
Markus

#1 lore raw
Quoted 1 line

Are involved subterms as often evaluated as they are specified for such SmPL conjunctions?

Will clarifications and development ideas evolve further also according to another SmPL script variant?

@Example@
@@
(
// X: Check data 1
&
// Y: Adjust data 2
)

Would a source code search start with the selection of entities which should be matched?

Which item would you choose for a condition check here?

Is collateral evolution involved then for the specification of SmPL code in companion branches like “Y”?

Regards,
Markus

#2 lore raw
Quoted 2 lines

Will clarifications and development ideas evolve further also according to another SmPL script variant?

Conjunctions have got properties which can be well-known.
https://en.wikipedia.org/wiki/Logical_conjunction

An usual goal would be for a source code search
that all conjuncts would become true.

A) SmPL code can be constructed which can never succeed.

@my_test@
declaration d;
statement s;
@@
(d
&s
)

Would it be nice if the Coccinelle software could point out that the mentioned code contains a specification mistake?

B) The conjuncts need to match entities according to common categories. Some entities are even supported as key words for metavariable types. Bigger entities can be constructed by a combination of smaller parts. Will it become helpful to reduce code repetition for this use case?

Regards,
Markus

#4 lore raw
Quoted 11 lines · Markus Elfring

Would you find SmPL code (like the following) not so useful in comparison to indicated software functionality according to another published test case?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/03a1af0a3316ddfc2b54d827b8b9627a841c85c9/tests/andid.cocci

@duplicate_metavariable_type@
identifier x, y;
@@
(x
&y
)

Certainly it does not seem very useful. But maybe there is some need to have two names for the same thing.

In the test you refer to (that you could have easily included in the mail instead of making me wait to have to load a link) the identifier metavariables have different constraints, so the pattern is useful.

julia

Quoted 5 lines

Regards,
Markus

#5 lore raw
Quoted 8 lines
Quoted 6 lines

@duplicate_metavariable_type@
identifier x, y;
@@
(x
&y
)

Certainly it does not seem very useful.

I hope that presented clarification approaches will evolve in more desirable directions.

* Can the Coccinelle software help any more to point similarly questionable SmPL code out?

* Would you find logical consequences apparent then?

Quoted 2 lines

But maybe there is some need to
have two names for the same thing.

This is obviously the case for other source code search variations. Identifier selection would become more interesting accordingly, wouldn't it?

Regards,
Markus