unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos via General Guile related discussions <guile-user@gnu.org>
To: Damien Mattei <damien.mattei@gmail.com>,
	 "Dr. Arne Babenhauserheide" <arne_bab@web.de>
Cc: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: RE: define-typed: checking values on proc entry and exit
Date: Thu, 20 Jun 2024 00:29:27 +0200	[thread overview]
Message-ID: <20240620002926.daVS2C00E0K6dk401aVSn6@andre.telenet-ops.be> (raw)
In-Reply-To: <CADEOadeM7erNjK5HrfZp8fuz8Z6eE=vKbmH-S8Vp6vwtROm8bg@mail.gmail.com>

>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	other threads:[~2024-06-19 22:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10  7:47 define-typed: checking values on proc entry and exit Dr. Arne Babenhauserheide
2024-05-10 22:49 ` Zelphir Kaltstahl
2024-05-14  1:39   ` Dr. Arne Babenhauserheide
2024-05-15  0:10     ` Dr. Arne Babenhauserheide
2024-05-21  2:30       ` Linas Vepstas
2024-05-11  2:48 ` Olivier Dion
2024-05-13  9:51   ` Ricardo Wurmus
2024-05-14  1:15   ` Dr. Arne Babenhauserheide
2024-05-11  8:18 ` Vivien Kraus
2024-05-14  1:34   ` Dr. Arne Babenhauserheide
2024-05-21  7:05 ` Damien Mattei
2024-06-19 22:29   ` Maxime Devos via General Guile related discussions [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240620002926.daVS2C00E0K6dk401aVSn6@andre.telenet-ops.be \
    --to=guile-user@gnu.org \
    --cc=arne_bab@web.de \
    --cc=damien.mattei@gmail.com \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).