Re:Ask HN: How many programming languages/development framew...
by kriyative on Thursday May 07, 2009 @08:33PM
(#598936)
This may seem really "out there", but I keep all the code of a package in one file. Not only does this reduce or eliminate asdf/defsystem maintenance, which I loathe doing, it also helps avoid the kind of habit you described. After all, the edits are all in one place.
To borrow a quote from the movie Highlander - "There can be only one (file)!"
Re:Ask HN: How many programming languages/development framew...
by mahmud on Thursday May 07, 2009 @09:04PM
(#598981)
the first thing I do with any new project is create a directory for it, the package.lisp file and the .asd. That much I do (though I should automate it, like weblocks does with defproject, hmmm)
but after that it's one file, until it gets too bloated and redundant, then i break it to two small redundant pieces.
Thought sometimes its too tempting to do everything in the repl: cramming a fat piece of code into one form and save the result as (setf foo *) if I like what I see :-D usually for experimentation with a new library I'm using for the first time.
Re:Ask HN: How many programming languages/development framew...
by Zak on Thursday May 07, 2009 @07:08PM
(#598838)
One thing that could help is to put everything like that in one place - say, a file called scratch.lisp in the root of the source tree. While it's not an ideal place to store any code long-term, it lets you know what still needs to be filed.
Re:Ask HN: How many programming languages/development framew...
by mahmud on Thursday May 07, 2009 @07:14PM
(#598846)
I have a misc.lisp file that I religiously copy stuff to. But usually, things go to misc first but later migrate to component level "package-misc" type locations, usually at the top of the component's file (I add stuff to the bottom and prefer to have a screenful of my working code, with less relevant code a PgUp or two away -- so stuff at the top is defpackage, in-package, defvars, conditional compilation stuff then the misc tools.)
Sometimes I go for so long not touching anything but Lisp, I end up writing weird stuff like "defstruct foo { int bar, char name};" whenever I need to wrap a C library to call out to :-P
[If any Lispers are reading this: I have this weird problem where I have a slime session running on screen for weeks, during which I write something in a temporary file, or inside another file, evaluate and edit it until it works .. but I forget it there! over time, the running application has little resemblance to the textual representations I have spread over several files, and it gets worse when I delete entire useless regions and refactor them. At least other languages have the decency to bondage-and-discipline me into naming my files and organizing the project hierarchy :-]