guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Maxime Devos
Subject: RE: define-typed: checking values on proc entry and exit
Date: Thu, 20 Jun 2024 00:29:27 +0200

>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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]