How to check for "recordness" #18

Closed
nyaray opened this Issue Feb 29, 2012 · 3 comments

Projects

None yet

2 participants

@nyaray
nyaray commented Feb 29, 2012

How do I check if a value is an instance of a record? A function is clearly generated since I get a warning about not using it, but I simply can't figure out how to call it via sheriff:check/2 calls.

I didn't really know who to ask, so I figured that an issue would be suitable (since it really isn't documented from what I've read). It would be nice if the answer to this question was included in the documentation for future users wanting to validate values as records and not just types.

@essen
Member
essen commented Feb 29, 2012

Hm that's a good point. There's a workaround, but I should check if we can do anything better:

-type myrec() :: #myrec{}.

doit() ->
    sheriff:check(42, myrec).

I'll get back to you on proper explanations and solutions.

@essen
Member
essen commented May 22, 2012

Records have been fixed, there was many issues: 166f28a.

However I don't really feel like more is needed, though it's definitely worth adding to the README, done here: e10f8ac.

Thanks for the report!

@essen essen closed this May 22, 2012
@nyaray
nyaray commented May 22, 2012

Awesome, thanks for picking it up again :). I agree, you probably don't need more functionality, that would be another lib/app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment