Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"I go on working for the same reason a hen goes on laying eggs." -- H. L. Mencken


devel / comp.lang.scheme / [Guile/Goops] Enforcing value restrictions in class c'tor

SubjectAuthor
o [Guile/Goops] Enforcing value restrictions in class c'toralicetril...@gmail.com

1
[Guile/Goops] Enforcing value restrictions in class c'tor

<1971d3ac-4bfa-4423-a30d-cbfbf5c174ecn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=68&group=comp.lang.scheme#68

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:ad4:5ccc:: with SMTP id iu12mr2552683qvb.21.1627515456047;
Wed, 28 Jul 2021 16:37:36 -0700 (PDT)
X-Received: by 2002:a05:6830:2783:: with SMTP id x3mr1625598otu.37.1627515455791;
Wed, 28 Jul 2021 16:37:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Wed, 28 Jul 2021 16:37:35 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:e190:b9b0:0:0:0:49;
posting-account=v_SVOwoAAADqhdg0geGPqbN_ubI98Rqh
NNTP-Posting-Host: 2600:1700:e190:b9b0:0:0:0:49
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1971d3ac-4bfa-4423-a30d-cbfbf5c174ecn@googlegroups.com>
Subject: [Guile/Goops] Enforcing value restrictions in class c'tor
From: alicetrillianosako@gmail.com (alicetril...@gmail.com)
Injection-Date: Wed, 28 Jul 2021 23:37:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: alicetril...@gmail.c - Wed, 28 Jul 2021 23:37 UTC

As an experiment to better understand GOOPS, I am currently writing a program in Guile using Guile-SDL2 and GOOPS, and as part of this I am implementing a simple wrapper class for RGBA values. I was looking to see if there was any way in GOOPS to enforce (via saturation) value boundaries of 0-255 for the individual color gradients. The simple wrapper class as I have it now is:
--------------------------------------------------------------------
(define-class <rgba-color>
(red #:accessor red-gradient
#:init-keyword #:r)
(green #:accessor green-gradient
#:init-keyword #:g)
(blue #:accessor blue-gradient
#:init-keyword #:b)
(alpha #:accessor alpha-gradient
#:init-keyword #:a))
--------------------------------------------------------------------

I know that this is a bit clumsy as it is, and I am not certain how useful this even will be, but I thought that it would make sense to wrap these values rather than dealing with the bare numerical values. I might switch to a simpler list or vector-based approach instead of a class if there's no straightforward way to enforce this pre-req in GOOPS.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor