unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Basile Starynkevitch <basile@starynkevitch.net>,
	 "guile-user@gnu.org" <guile-user@gnu.org>
Subject: RE: Advice on ST-Object data-structure setup
Date: Wed, 17 Apr 2024 18:34:19 +0200	[thread overview]
Message-ID: <20240417183420.CGaK2C00F3BbbgK01GaL5E@laurent.telenet-ops.be> (raw)
In-Reply-To: <cd7a3985-b4d0-44fb-81e1-f99865bb839a@starynkevitch.net>


>is to get the mechanics working.  For this I 
> need to have an St-Object which is basically a Vector but which 
> answers #false to vector? and #true to st-object?
>
> [Note https://github.com/KenDickey/Crosstalk/blob/master/st-kernel.scm ]
>
> I note that one might change the T7 type-tag from 0x0d (vector) to 
> 0x6d (currently unused) with a quick bitwise-or, but would like some 
> advice on the best way to do this or some alternate.  I would prefer 
> to work in Scheme, not C, BTW.

It would be simplest to define a record type with a single field, let’s say ‘<st-vectorlike>’ with a field ‘actual-vector’(*)

(*) plus whatever fields are required to make it satisfy ‘st-object?’

The objects of type <st-vectorlike> are by construction not vectors (so, they don’t satisfy vector?). However, you can easily define

;; st-vector-ref: rename this to the equivalent of vector-ref in Smalltalk,
;; and replace ‘define’ by what would be the equivalent in Smalltalk
(define (st-vector-ref v n)
  ;; st-vector-like-actual-vector: field getter
  ;; vector-ref: standard Scheme procedure
  (vector-ref (st-vector-like-actual-vector v) n))

and the like.

Best regards,
Maxime Devos.


  reply	other threads:[~2024-04-17 16:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 21:14 Advice on ST-Object data-structure setup ken.dickey
2024-04-17  7:10 ` Basile Starynkevitch
2024-04-17  7:14   ` Basile Starynkevitch
2024-04-17 16:34     ` Maxime Devos [this message]
2024-04-17 14:28   ` ken.dickey
2024-04-17 16:34 ` Maxime Devos
2024-04-17 18:29   ` ken.dickey
2024-04-20  9:49 ` Mikael Djurfeldt
2024-04-20 10:03   ` Mikael Djurfeldt
2024-04-20 15:08   ` ken.dickey

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=20240417183420.CGaK2C00F3BbbgK01GaL5E@laurent.telenet-ops.be \
    --to=maximedevos@telenet.be \
    --cc=basile@starynkevitch.net \
    --cc=guile-user@gnu.org \
    /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).