draperlaboratory / hope-policy-tool

Policy language tools
Other
0 stars 0 forks source link

DPL Rule Macros #35

Open sbrookes opened 5 years ago

sbrookes commented 5 years ago

Often we have a set of rules that generate a certain pattern of behavior around a specific metadata tag... but we want to apply that behavior to multiple unique tags. A DPL macro would be very helpful here.

Example: https://github.com/draperlaboratory/hope-policies/blob/master/osv/ppac.dpl#L99

Blocks of rules with comments like "behavior x for patient", "same for doctor", and "same for admin" are prime targets for replacement with macros.

ccasin commented 5 years ago

It's probably a good idea to add some notion of functions in DPL. In the mean time, you can use CPP macros directly. The DPL parser handles the cruft left behind after running the CPP.