The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Wednesday, April 05, 2006

Failed to get the memo

So I'm still working with Lisp Scheme guile, and I'm still questioning if Lisp Scheme guile is a HLL or a HHL-wannabe.

I'm at a point where using a structure would be the best thing to use. A structure is nothing more than a collection of data (possibly of different types) that can be treated as a unit. In C, a typical structure definition would be (example from my own code):

/* data associated with a web-request */

struct http
{
  URLHTTP url;
  List    headers;
  Stream  io[2];
  int     version;
  int     status;
};

Pretty straight forward.

I check the the documentation and yes, it supports structures.

Cool!

So, here's how you define a “simple” structure with only two elements:

(define ball-root (make-vtable-vtable "pr" 0))
          
(define (make-ball-type ball-color)
  (make-struct ball-root 0
	       (make-struct-layout "pw")
               (lambda (ball port)
	         (format port "#<a ~A ball owned by ~A>"
                         (color ball)
                         (owner ball)))
               ball-color))
        (color ball) (struct-ref (struct-vtable ball) vtable-offset-user))
        (owner ball) (struct-ref ball 0))

What? Did Lisp Scheme guile take lessons from Forth? I have to manually construct the structures? This is a HLL? And not only do I have to write code to create structures, but I also have to write code to populate them. Anyone remember BASIC?

10 DIM A(20):FOR I=1 TO 20:READ A(I):NEXT I
20 DATA 3,4,23,88,2,3,4,9,10,12,44,87,8,7,6,13,33,8,29,0

(Which, incidentally, is another pet-peeve of scripting languages—the inability to have pre-initialized data at run time.)

I suppose I could always write code to make structures easier, but why should I have to abstraction to what is arguably the highest level programming language in existance? (although structures might be easier to use in Common Lisp, I don't have a Common Lisp environment to test it) Have structures fallen out of vogue in HLLs? Did I fail to get the memo?

Obligatory Picture

[The future's so bright, I gotta wear shades]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: https://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

https://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.