[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: define - any name
From: |
Andreas Rottmann |
Subject: |
Re: define - any name |
Date: |
20 Apr 2003 16:58:38 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Egil Moeller <address@hidden> writes:
> At the moment, I have a function (list-entry type name), that given a
> "type-definition" (a binary tree with names in), and a name, constructs a
> function that will extract the entity at the position corresponding to
> that name in the type, in a binary tree given as argument. The
> "type-definition" i often constructed from other such definitions:
>
> (define fride-vote-msg-type
> `(list
> (id: ,fride-id-msg-type)
> (referendum: ,fride-id-reference-msg-type)
> (date: int)
> (vote: int)))
>
> I use the list-entry function, then to construct a set of
> "access-functions", e.g.
>
> (define fride-vote-list.id (fride-list-entry fride-vote-msg-type 'id))
> (define fride-vote-list.referendum (fride-list-entry fride-vote-msg-type
> 'referendum))
>
> This is both quite some extra work, and also makes the code clumsier, than
> if those functions could be automatically created. I'd like to write
> something like
>
> (define-type fride-vote-msg-type
> `(list
> (id: ,fride-id-msg-type)
> (referendum: ,fride-id-reference-msg-type)
> (date: int)
> (vote: int)))
>
> and have them all created. For this purpose I have created a function that
> finds all names in a type-definition that can be used to create such
> access-functions.
>
I think you can get this easier with GOOPs - have a look at its
setters and getters concept...
Regards, Andy
--
Andreas Rottmann | address@hidden | address@hidden | address@hidden
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62
Python is executable pseudocode, Perl is executable line-noise.
- define - any name, Egil Moeller, 2003/04/19
- Re: define - any name,
Andreas Rottmann <=