Another Issue with Validation [VERY IMPORTANT]

Luke Gorrie luke@REDACTED
Wed Oct 2 09:37:57 CEST 2002

Sebastian Strollo <seb@REDACTED> writes:

> Howdy Luke,
> > Quick summary of how this works, I don't remember how much of this
> > existed while you were here but this is the gist:
> Not much, I recall seeing emails back and forth about it when you were
> working on it though. Thanks for the quick intro - it is really cools
> stuff! (I promise I will read the manual too...) Btw, can you have
> fun's in the validations too?

We have {call, M, F, A}, but not funs. It's often nicest to just add a
new builtin, because to evaluate {FunName, Arg1, Arg2, ...} the
interpreter basically just does:

  apply(reg_rules, FunName, [Arg1, Arg2, ...])

So reg_rules.erl just contains a bunch of functions like:

  between(X, Y, Z) -> (X >= Y) and (X =< Z).

We did add funs on the SSL branch, for things like:

  {apply_fn, fun(V) -> V < 10 end,
             [{value, self}]}

Which is done in reg_rules with:

  apply_fn(Fn, Args) -> apply(Fn, Args).

Plus a little tweak to this arg_eval_strategy/1 function to say that
the Args argument should be evaluated as a list.

> Ok, but when there is a whole bunch of these in the log file it is
> kind of hard to see when it started to work... Don't know if you keep
> any state, but if it is something that is retried a number of times it
> might be nice with log messages like "No such.... retrying" ... and
> then when it succeeds a single message telling you that it
> worked. Just a thought.

Maybe a decent quick fix would be to do an info message when we start
a commit - that way you can see which callbacks weren't registered
each time. Since we always retry a callback that failed the previous
time, you'll always get the "callback not registered" messages until
it actually succeeds.

> Given the premise that they have some rules with callbacks, I think
> what Biju is saying that if you have *not* registered your (cli and
> rdt) callbacks the CLI/validation is starting to behave in an
> unexpected manner. As far as I understand the example just shows that
> "all of a sudden a value is rejected".

Yeah. Thanks for the RDT files - I'll have a look through them now and
see if I can find the problem.


-------------- next part --------------
[ Bugbear virus removed from archive ]

More information about the erlang-questions mailing list