RE: define-typed: checking values on proc entry and exit

Maxime Devos via General Guile related discussions <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
>Hello,
>
>not sure to understand but does GOOPS (Guile object model) allow some sort
of check to the argument but perhaps it is only inherent to the procedures
of a 'class' in the object model?

I don’t know what ‘procedures of a class’ means, but otherwise yes, with the caveat that the check must be a type-check, in the sense that it checks whether the argument is of a certain class. 

The documentation https://www.gnu.org/software/guile/manual/html_node/Methods-and-Generic-Functions.html has a bunch of examples. I recommend reading it. (Also note that <number> is a class.)

Now, that the check must be a type-check isn’t actually much of a limitation, since you can just check other conditions in the body and call next-method when it doesn’t match.  (I’m not entirely sure though, I wonder what happens if you define a method of a generic with the same type signature as an another method of the generic).

Best regards,
Maxime Devos.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.