Re: [Cocci] Avoiding code duplication for SmPL constraints
On Sat, 17 Feb 2018, SF Markus Elfring wrote: > >> Now I am looking again for further possibilities to avoid corresponding > >> code duplication. > >> > >> * Scripted constraints might be a design option. > >> Unfortunately, I find the documentation for this functionality still > >> incomplete. > > > > What information do you find to be lacking? > > I would appreciate if the place for the desired predicate will be better > explained. > > May they refer to a predefined function? When you write eg identifier x : script:python(...) { ... }; or identifier x : script:ocaml(...) { ... }; Between the { ... } you can put any code that you could put in a python or ocaml script, respectively. julia ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Avoiding code duplication for SmPL constraints
On Sat, 17 Feb 2018, SF Markus Elfring wrote: > Hello, > > Constraints can be specified for metavariables of the semantic patch language. > I noticed that they can trigger software maintenance challenges > when bigger specifications are repeated in some SmPL rules. > Now I am looking again for further possibilities to avoid corresponding > code duplication. > > * Scripted constraints might be a design option. > Unfortunately, I find the documentation for this functionality still > incomplete. What information do you find to be lacking? > * I imagine that it would nice if constraints could be set by programming > script > rules at a single place. The simplest thing to do is to define a function in the initialize part of the semantic patch, and then call that function in the constraints as needed. julia ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
[Cocci] Avoiding code duplication for SmPL constraints
Hello, Constraints can be specified for metavariables of the semantic patch language. I noticed that they can trigger software maintenance challenges when bigger specifications are repeated in some SmPL rules. Now I am looking again for further possibilities to avoid corresponding code duplication. * Scripted constraints might be a design option. Unfortunately, I find the documentation for this functionality still incomplete. * I imagine that it would nice if constraints could be set by programming script rules at a single place. Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci