[erlang-questions] [ANN] sheriff 0.2: parse transform for type-based data validation

Ulf Wiger ulf@REDACTED
Thu Feb 16 09:59:06 CET 2012


On 15 Feb 2012, at 00:23, Tristan Sloughter wrote:

> Hmm, yeah. And I should have mentioned I modified Ulf's exprecs to have slightly different syntax but the main thing was to also use types in records to add calls to convert (which I may change to check...) for setting each attribute of a record.


Interesting.

Exprecs now also generates type signatures for the accessor functions, and does have some added support for controlling the naming of the accessors. I'd be interested in hearing if this support is insufficient for you. This was in response to Joel Reymont wanting full type signatures, and thinking that the exprecs naming convetion was hideous. :)

Two reasons: (1) I'm of course curious to see how exprecs can be improved, and (2) I assume it would be better for you if you didn't have to maintain your own hacked version.

I could also imagine running vanilla exprecs first and then another transform which e.g. does function renaming (hmm… there's an idea for a new transform :)

BR,
Ulf W

From https://github.com/esl/parse_trans/blob/master/doc/exprecs.md :

It is possible to modify the naming rules of exprecs, through the use
of the following attributes (example reflecting the current rules):

  -exprecs_prefix(["#", operation, "-"]).
  -exprecs_fname([prefix, record]).
  -exprecs_vfname([fname, "__", version]).
  
The lists must contain strings or any of the following control atoms:

in exprecs_prefix: operation
in exprecs_fname: operation, record, prefix
in exprecs_vfname: operation, record, prefix, fname, version

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120216/992f0aaa/attachment.htm>


More information about the erlang-questions mailing list