Re:Squants: The Scala API for Quantities, Units of Measure a...
by bronty on Friday March 21, 2014 @09:25PM
(#7446511)
There's two different issues here: (1) whether or not to use compiler plug-ins, and (2) whether or not to use compiler plug-ins for metaprogramming.
Using plug-ins for automated analysis improves the quality of your codebase. The annotations serve as a machine-checked documentation which make the code easier to debug.
As you point out though, the benefits of plug-ins for metaprogramming (such as implementing a DSL) is not always as clear-cut: you have to pay the price of maintenance, much of which is not always obvious up-front.
You face many of the same issues when designing a DSL in Scala --- the DSL may generate code that depends on a custom run-time or library.
Using plug-ins for automated analysis improves the quality of your codebase. The annotations serve as a machine-checked documentation which make the code easier to debug.
As you point out though, the benefits of plug-ins for metaprogramming (such as implementing a DSL) is not always as clear-cut: you have to pay the price of maintenance, much of which is not always obvious up-front.
You face many of the same issues when designing a DSL in Scala --- the DSL may generate code that depends on a custom run-time or library.