Dan has trouble with planning. Here's what has worked very well for me so far:

  1. write exactly what I need right now
  2. when patterns emerge: refine, revise, or rewrite
  3. repeat

I used to be pleasantly surprised by how easy step 2 is with Lisp. Now it's no longer surprising, and only pleasure remains.

Tags:

Comments

(Anonymous)

Accessors...

I just wanted to ask a brief question about accessors..

Nikodemus Siivola posted about FOO-OF which is fine, but this doesn't solve the problem I usually have with accessors and thats the fact that I commonly have a lot of classes which have the same name.

ie.

Card class has an attribute value
Number class has an atribute value

So I have two value accessors with the same name. They're in two separate packages lets say, or even one of them is in a separate package and it imports the other. So I have two defgeneric's for value.

What's the best way to handle this situation? This is what I'm struggling on.

Thanks,

Eric

(Anonymous)

Re: Accessors...

Sorry that should have read.... "classes which have attributes with the same name."

Re: Accessors...

When they are in separate packages, shadow.
(defpackage :number
  (:shadow :value)
  (:use :card))

Re: Accessors...

Or import.

Though I have actually punned on the difference in occasion (in a system for dealing with routing protocols).

There is a subtle difference between OSPF:PREFIX, BGP:PREFIX, RIP:PREFIX and IP:PREFIX...

Re: Accessors...

I was amused by a code snippet from Erik Naggum that had ISO:|8601| as a function for use in format.

http://groups.google.com/group/comp.lang.lisp/msg/2caf4e2d6bc1dbdd

(Anonymous)

Re: Accessors...

I see... that's what I'm currently doing, which just gets rid of the warning. I was wondering if this was common practice or what, since I could see it becoming annoying always having to shadow a bunch of stuff every time you use a new package.

Or maybe that just means the packages are just to granular. I'm not sure.. I guess I just need to grunt through it more. Wish there was more material discussing the gotcha's and common issues which occur when using CLOS, rather than just explanations of the CLOS itself.

Re: Accessors...

In general, if you want to :use a package, you must know what it exports and how it will interact with the :using package. You can't get by on just trying things and seeing what happens.

September 2014

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930    
Powered by LiveJournal.com