freenode/#lisp - IRC Chatlog
Search
3:58:01
rk[ghost]
finally got it to spit out the location of the file, however i see now that it deletes the file upon the completion of the request
5:25:36
Devon
Wednesday when #lisp got spammed by someone's paste buffer gone mad, the following lines appeared:
6:54:27
Colleen
Clhs: special operator if http://www.lispworks.com/documentation/HyperSpec/Body/s_if.htm
8:03:57
jdz
Or have another video camera recording the output of the first video camera (also with a delay) and you only have to hit once and be entertained for a long time.
10:22:37
dmiles
durring lisp compile if a (load "otherfile") is encountered should that other file be compiled ?
10:23:40
dmiles
ok good.. but this actualy file being compiled is still expected to laod that file right?
10:23:57
beach
If it's on the top level, then the compiler will generate a call to LOAD and that call will be executed when the compiled code is loaded.
10:25:40
dmiles
i was concerned that the (load "file") file might contain macros that the compiled file needs... so i assumed all the side effects of the otehr file would need to be carried out
10:28:25
beach
3. It should be using an ASDF system definition instead of explicit calls to LOAD and COMPILE-FILE.
10:30:16
beach
Most time will be spent in calls to LOAD or COMPILE-FILE when this code is loaded, ether as source code or as compiled code. So whether this code is compiled or not does not make any difference.
10:30:55
dmiles
once you ran that file.. next you might run this file.. https://github.com/eriktmueller/daydreamer/blob/master/dd_get.cl
10:32:19
dmiles
so i assume nhow that those are compiled.. the things in the ff_get using (load ..) are getting a benefit
10:33:24
dmiles
Benefit of (compile-file "dd_cntrl.cl") (compile-file "dd_epis.cl") in that first file shown
10:34:29
beach
Compiling a file that contains calls to COMPILE-FILE like that will not call those compile-file forms.
10:36:28
beach
I maintain that this code has many problems. You need some DEFPARAMETERs in there and you need to write an ASDF system.
10:36:33
dmiles
ok so next issue.. someine called (compile-file ) on.. https://github.com/eriktmueller/daydreamer/blob/master/dd.cl
10:37:02
beach
And while you are at it, fix the number of semicolons. It should be 3 for a top-level comment.
10:39:03
beach
The compiled code will just contain code for the SETQ and the following function calls.
10:40:34
beach
And, like I said, using SETQ on an undefined variable like that is undefined behavior, and a good Common Lisp system will signal an error.
10:42:30
dmiles
though this program works on clisp and a couple other systems.. and only gets compiled since someonje first invoke the compiler script called dd_compile.cl .. and then they pick up the compiled reasults durring (laod ..) the dd_get.cl script
10:43:30
dmiles
one file doesnt compile right on a certain lisp .. so i relete the fasl and then run dd_get.cl
10:45:25
beach
It works on some Common Lisp systems because they define that undefined behavior as "declare the variable special" and that is a very bad idea to do.
10:47:34
beach
So it is better to use a Common Lisp implementation with stricter treatment of this particular undefined behavior, namely, to signal an error so that the programmer can fix his or her typo.
11:43:20
tomlukeywood
Dose anyone know why this never returns "False" and just returns nil when (eql (aref universe cell-x cell-y) 0) is not true?
11:45:48
Shinmera
So instead of trying to decipher it, I'll just say (cond (t1 f1) (t2 f2) (t3 f3) (T f4) <=> (if t1 f1 (if t2 f2 (if t3 f3 f4)))
12:12:23
pjb
The extra windows are temporary and user configuration. Use C-x 1 C-x 2 C-x 3 and C-x 0 to deal with them.
12:14:50
pjb
paule32: honestly, I don't know, I never use menus; I even configure my emacs to hide them from me.
12:15:12
pjb
You may use the menu, but once you know the key binding for the command, it's easier and faster to use it.
12:15:35
pjb
Also, thru irc, it's easier to give you key chords to type, rather to tell you to go to such and such menu.
13:21:28
jmercouris
Given CLASS A, is there a way to enforce that all classes extending CLASS A implement a set of methods?
13:23:24
jmercouris
beach: Can you please explain further, what does it mean when a method is specialized? When it has slots with one of the type specifiers being class A?
13:24:33
Shinmera
jmercouris: What would you want to happen if there is no method specialising on a subclass of A?
13:24:38
beach
Well, since methods are classes, they do have slots, but in this case, it has to do with the parameter of the method being restricted to A.
13:26:30
jmercouris
Shinmera: The program should not be able to load, to enforce that all the methods have been implemented
13:26:45
beach
jmercouris: That's a very basic question about methods and generic functions. Are you sure you should be using such things without reading up first?
13:27:18
Shinmera
If you define a new subclass, should it just immediately error because the methods for it don't exist?
13:27:21
jmercouris
beach: I've read already, I find I learn best by doing, making mistakes, and then trying to understand what I did
13:28:01
jmercouris
Shinmera: I thought the check could happen during something like initialize-instance :after
13:28:04
Shinmera
If you can't define the class, because it errors due to a lack of said methods, you can't add the methods, because specialising on a class in a method requires the presence of the class.
13:29:23
Shinmera
If there is no method specialising on a class it will error when you try to call its generic function anyway.
13:30:03
jmercouris
The reason this topic keeps coming up in my head was because I was told some time ago, perhaps two weeks or something, that I should convert my "Interface" package to a CLOS object, and I want several interfaces to extend from a parent CLOS, but in order to be a valid extension, they need to implement a set of methods
13:30:35
jmercouris
Yeah, I am the only one using my internal API for now, I'll just avoid trying to force a protocol
13:31:05
Shinmera
What you can do, for your own safety, is implement a function that you can run manually to "check the integrity"
13:31:07
beach
jmercouris: An "interface" in a traditional object-oriented language often translates to a set of generic functions.
13:31:22
Shinmera
Said function would use something like compute-applicable-methods to discover whether the necessary methods are in place.
13:31:43
jmercouris
beach: But generic functions can remain unimplemented though, so I don't get that safety which is what I'm looking for
13:32:51
Shinmera
It would signal an error, giving you a debugger, and the ability to fix the issue.
13:33:14
Shinmera
When you've implemented the method you can then use the "retry call" restart and continue where you left off.
13:34:51
jmercouris
It's hard to "unlearn" so many years of other languages, I have to change my approach
13:35:08
beach
jmercouris: You are confusing two types of exceptional situations. One is a program defect, namely the programmer omitted to make sure some generic function can handle the kinds of objects that is given to it as an argument. Such an exceptional situation should indeed signal an error that the programmer must then deal with.
13:35:31
Shinmera
Lisp embraces the dynamism. Doing static checking is hard, because it would often make incremental approaches impossible or very annoying.
13:36:04
beach
jmercouris: The other exceptional situation is if the USER of your program does something that the program can not handle. Then there should be a friendly message and a way to continue using the program.
13:37:16
beach
jmercouris: To avoid having an error signaled when the USER is using your application, you test it before shipping it.
13:37:23
jmercouris
beach: The user can trigger a function that the program cannot handle because the programmer forgot to implement some function
13:37:54
beach
jmercouris: You test the program first. You have to anyway, to make sure those functions do the right thing.
13:38:12
jmercouris
Yeah, I'll have to do that, and I'll just have to "document and trust" with defgenerics in the superclass
13:38:49
jmercouris
I've at least stripped all of the foreign code and isolated it to a single interface
13:42:06
Shinmera
It's more useful to think about the generic function as operations, which are what you really care about, and classes as things to do these operations with.
13:43:19
Shinmera
I don't see an issue with saying that your operation operates on a certain hierarchy of objects, so defining the root of that alongside the generic function isn't a problem.
13:43:46
Shinmera
It's more that the class is defined alongside the generic functions than the other way around.
13:45:43
jmercouris
Shinmera: I think I'm finally starting to understand some of the value behind CLOS
13:46:41
jmercouris
and the real magic, is the functions, and different functions can specialize on different data containers
13:47:57
Shinmera
The general example that illustrates this point is if you have a (draw thing canvas) function. This operation depends just as much on what is drawn, as well as where it is drawn to. It makes no sense to try and attribute it to either one of the arguments.
13:48:02
pjb
paule32: even if types are associated with values, and not with variables, and even if T is the super type of all types, unless you have a specific reason to do horrors such as initializing a *menu* to an integer such as 0, you should avoid it!
13:49:09
jmercouris
Shinmera: Aha, yes, that does make a lot of sense, depending on the type of canvas object, the operations could be radically different, so you want to be able to specialize on multiple objects for a given function
13:49:24
pjb
paule32: also, in general you will want defparameter rather than defvar, since defvar assigns the value only if the variable is not already bound.
13:49:55
jmercouris
Thank you for the explanations, I'll need to absorb and internalize this information for a little bit, but I think I am getting there
13:50:26
pjb
paule32: you can iterate on lists with dolist, loop for x in list, map, mapc, mapcar, mapcan, mapl, maplist, mapcon, do, do*, etc.
13:50:58
pjb
paule32: so read in the Hyperspec about those operators, and then choose one of them to iterate in your menu list.
13:59:39
larsen
pjb: I think the very first implementation was in Basic (first experiment by Dan Ingalls)
14:01:05
pjb
jmercouris: currently, beach is right that you should test to detect such errors. However, you could perform a global analysis of your sources to check at "compilation" time whether all the required methods are implemented. You would probably need additionnal annotations (eg. in form of declarations).
14:05:04
pjb
jmercouris: you can easily come with algorithms to perform specific global checks such as this one.
14:06:58
pjb
jmercouris: the worst difficulty is actually reading the source of a lisp program. It's easy if you load it in the current image and perform introspection. But you can only validate it for the current implementation with the current set of *features* etc. Sometimes you would want to read it without modifying the current image, and analyse also the read-time variants. For this you can use something like my lisp reader, providin
14:07:45
pjb
(You still need to read yourself the sources, to process it, notably take note of the declarations, since there's no conforming API to get the declarations for a given form).
14:09:43
jmercouris
pjb: Sounds like a rabbit hole I don't want to go down just yet, or perhaps ever :D