Making structures useable
From: M Jared Finder (hpalace_at_hpalace.com)
Date: 08/25/04
- Next message: Jeff: "Re: Making structures useable"
- Previous message: Jeff Caldwell: "Re: Newbie Question: Why is (if ...) a special operator?"
- Next in thread: Jeff: "Re: Making structures useable"
- Reply: Jeff: "Re: Making structures useable"
- Reply: Marco Baringer: "Re: Making structures useable"
- Maybe reply: Tim Bradshaw: "Re: Making structures useable"
- Reply: Mark McConnell: "Re: Making structures useable"
- Reply: Frode Vatvedt Fjeld: "Re: Making structures useable"
- Reply: Joe Marshall: "Re: Making structures useable"
- Reply: Wade Humeniuk: "Re: Making structures useable"
- Reply: Paolo Amoroso: "Re: Making structures useable"
- Reply: Andy Freeman: "Re: Making structures useable"
- Reply: Jock Cooper: "Re: Making structures useable"
- Reply: M Jared Finder: "Re: Making structures useable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 24 Aug 2004 21:26:26 -0700
Coming from a C/C++ background I like structures. A lot. The thing is,
I find DEFSTRUCT's default accessors to be horribly horribly verbose. I
am looking for a way to reduce the amount of text on screen so but still
use structures.
For example, for a simple structure of structures, like the following
require a huge, verbose line for every member access!
(defstruct joystick-axis
"A joystick axis and its limits"
index
min
max)
(defstruct joystick-input-map
"A map of joystick axes and buttons to our format"
(left-stick-axis-x :type joystick-axis)
(left-stick-axis-y :type joystick-axis)
(right-stick-axis-x :type joystick-axis)
(right-stick-axis-y :type joystick-axis))
;; This is way too long and verbose!!!
(joystick-axis-index (joystick-input-map-left-stick-axis-x joystick))
This is just way too verbose for my tastes! I need a shorter way to
express what I want to do so I don't get bogged down by details like this.
I've noticed that CLOS has a function SLOT-VALUE that adds uniformity to
the code as well as shortening it. This seems good because I could
define a macro for member access. Currently I see creating a read macro
to for a CLOS class to be the best option. That way I could write
something like the following expression, which I feel is much closer to
what I want to express.
@(joystick :left-stick-axis :index)
This seems like something that people must have solved previously (or
perhaps there is a solution in the standard). That is why I would like
your input. I need feedback from people who have written big projects
and therefore must have run into this problem before.
-- MJF
- Next message: Jeff: "Re: Making structures useable"
- Previous message: Jeff Caldwell: "Re: Newbie Question: Why is (if ...) a special operator?"
- Next in thread: Jeff: "Re: Making structures useable"
- Reply: Jeff: "Re: Making structures useable"
- Reply: Marco Baringer: "Re: Making structures useable"
- Maybe reply: Tim Bradshaw: "Re: Making structures useable"
- Reply: Mark McConnell: "Re: Making structures useable"
- Reply: Frode Vatvedt Fjeld: "Re: Making structures useable"
- Reply: Joe Marshall: "Re: Making structures useable"
- Reply: Wade Humeniuk: "Re: Making structures useable"
- Reply: Paolo Amoroso: "Re: Making structures useable"
- Reply: Andy Freeman: "Re: Making structures useable"
- Reply: Jock Cooper: "Re: Making structures useable"
- Reply: M Jared Finder: "Re: Making structures useable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]