freenode/#lisp - IRC Chatlog
Search
10:44:28
earl-ducaine
I'm running into a peculiar error with cffi:with-foreign-slots. The message: Attempt to bind a special variable with SYMBOL-MACROLET: WIDTH
10:45:04
earl-ducaine
looking at the expansion the following is a minimal example of that type of error:
10:45:06
earl-ducaine
(defparameter WIDTH 1) (SYMBOL-MACROLET ((WIDTH 2)) (FORMAT T "width: ~d~%" width))
10:45:24
earl-ducaine
This is the full code: https://gist.github.com/earl-ducaine/786b3c616ee014a7359e554619322924
10:46:30
|3b|
"If an attempt is made to bind a symbol that is defined as a global variable, an error of type program-error is signaled. "
10:46:39
earl-ducaine
Yes, so the problem seems to be that if you have a special variable that has the same name as you've assigned to one of your structure slots, you get the error.
10:49:59
|3b|
possibly with-foreign-slots should allow explicitly naming the variable so you could work around that, but not really a 'bug'
10:51:50
earl-ducaine
Holy crap. I'd never noticed that before. I'd always assumed that with-slots created a lexical binding for the slot name.
10:53:06
|3b|
no portable way to make a lexical binding that overrides a global special declamation, so it can't do that (without being a special form at least), and it would still have to figure out how to get the writes back to the slot
10:53:48
didi
Constants are a weird thing to have in a highly interactive environment. I always try to redefine them at some point.
10:54:33
|3b|
maybe if i can prove that some specific thing actually affects performance i might change it to a constant
11:25:49
stacksmith
|3b|: SBCL definitely compiles shorter code if you use constants. Of course it's not worth it unless it's in a tight loop...
11:32:52
Shinmera
Any idea why Drakma might be interpreting a stream with a wrong encoding even if I explicitly specify :external-format-in as :utf-8 AND the server returns a conte-type with charset utf-8?
12:42:52
Colleen
There is no applicable method for the generic function
#<STANDARD-GENERIC-FUNCTION OXENFURT:PHONETIC-SPELLING (1)>
when called with arguments
(#<OXENFURT:LEXICAL-ENTRY "lisp" EN>).
12:44:49
Colleen
lisp /lɪsp/
(noun): a speech defect in which s is pronounced like th in thick and z is pronounced like th in this
(verb): speak with a lisp
(noun): a high-level computer programming language devised for list processing.
12:47:11
Shinmera
I'm not sure what you're telling me to do. I can't exactly shorten the definitions.
12:58:57
_death
for example, a bot could have a "personality" (changing every week? :) and pick a definition according to it..
13:01:46
Shinmera
That first example sounds awful, and the second one sounds very hard and prone to errors.
13:01:56
myrkraverk
Shinmera: iirc, you can set your own conversion routine, which is what I did in one project.
13:03:20
myrkraverk
In other news, apparently lldb can't print a variable if it's called "new" in C.
13:50:13
fourier
anyone about limitatons of SLY in contrast to SLIME? Just installed and it looks real good. Any reasons not to switch to it from SLIME?
13:51:10
makomo
Xach: i found this answer of yours https://stackoverflow.com/a/22796292 that references a dead link. web.archive also doesn't give me back anything
13:51:32
makomo
Xach: would this be the original paper? https://web.archive.org/web/20070204110210/https://common-lisp.net/project/movitz/files/movitz.pdf
13:51:48
makomo
(by the above web archive comment i was referring specifically to the link you gave in the answer)
14:40:21
beach
Hah! There was a bug in the incremental parser for Second Climacs. Once the bug fixed, the parser is 10 times as fast as we claimed in our ELS submission. For a buffer with 120 top-level forms, each 10 lines long, inserting and deleting an opening parenthesis at the beginning (this the worst-case scenario) takes less than 2ms for the parser to handle. And there are no doubt even more optimizations possible.
14:40:57
beach
So we will supply more and better benchmark results for the final version of the paper.
16:02:43
beach
flip214: A parse result indicating end-of-file was stuck in the data structure and prevented the cache from working properly.
17:29:59
pjb
beach: way to prepare for a Steve Jobs presentation! Others did it in 100, we it in 10. Oh, and one last thing, actually we did it in 1!
17:34:19
beach
pierpa: The latest version is here: http://metamodular.com/incremental-parsing.pdf but it is still not the final version.
17:34:36
beach
pierpa: The referees wanted more benchmarks, so that is what I have been working on so far.
17:36:04
pierpa
aha! so you cache whole top-level exprs, I guess. I thought you cache at a fiber grain
17:37:34
beach
Expressions form a tree, and when a top-level expression is modified, I rescue the sub-expression that are still valid.
17:39:21
beach
And this is despite the fact that I use Gray streams, so I have several generic-function calls for each character read.
17:40:18
beach
Another piece of evidence that the right data structure with no particular micro optimizations beats the wrong data structure with lots of micro optimizations.
17:41:09
pjb
(eval-when (:compile-toplevel) (set-macro-character #\' (quote some-strange-quote-syntax))) (defun foo () 'foo)
17:41:41
beach
pjb: Currently I only parse them and compute indentation. Later, I will try to use an incremental version of my first-class global environments between each top-level form and actually call the compiler at typing speed.
17:42:35
beach
You are funny, just like some of the referees. I mean, I do orders of magnitude better than any existing editor. And I get harassed for not solving the halting problem at typing speed.
17:43:08
beach
So, yes, there are still cases that I can't handle, and some that I never will be able to handle.
17:43:23
pjb
Well, there are reader macros that allows to embed different programming languages. You just have to be careful with them, (avoiding indenting python or pascal code like lisp code).
17:44:43
beach
Custom reader macros are handled correctly, but I can't do much with what they return.
17:44:56
pjb
Ultimately, there's the problem of #+sbcl #-sbcl, where you could have to ident differently a form, depending on the implementation… This is a problem for all the docstring parsers I've seen.
17:45:51
beach
I don't plan to process forms that are read with read-ignore (is that what it is called?).
17:46:14
pjb
beach: you can always say that what is difficult for your program to process, is difficult for the human programmer to read, so it ought to be written differently.
17:47:06
beach
There is a phase where I try to match up the parse results with the expression returned by the reader. If they are too strange, I don't compute indentation.
19:04:39
Guest43479
Hey - just installed sbcl via homebrew on osx. I used `which sbcl` and used that with the shebang in the header `#!/usr/local/bin/sbcl --script` but it doesn't appear to load properly when run. Running this just via the command line works fine `/usr/local/bin/sbcl --script filename.lisp` not sure if anyone else had run into this?
19:40:03
Guest43479
./compile.lisp: line 3: syntax error near unexpected token `;;' ./compile.lisp: line 3: `;; testing comment'
19:47:43
malice
If all you want to do is run a script, you might also want to check out the Roswell project: https://github.com/roswell/roswell
19:51:34
malice
Also, since you're on mac, try to change the shebang for nonsense and see if it still works this way. On my system, giving wrong path shows "wrong interpreter[...]"; it might be that your interpreter is not loading properly
19:55:02
Guest43479
Interesting, thanks, yeah I'm getting a bad interpreter with nonsense for the shebang
19:58:59
Guest43479
Its not too big of a deal since `sbcl --script filename.lisp` is working, more curious than anything else
20:29:52
stacksmith
I am using CFFI to manage a foreign buffer. It contains multiple instances of a C structure at offsets not known until runtime (and changing often). WITH-FOREIGN-SLOTS seems to be a dead end as it has no provision to take an additional has no provision to take an additional offset - And it would have to be a dynamic offset as I need to access multiple instances of this structure... Any suggestions?
20:32:59
stacksmith
I am reluctant to use inc-pointer after learning that it conses up new pointers every time - I would prefer to avoid that...
20:36:54
stacksmith
Basically, I need the symbol-macrolets generated by with-foreign-slots to add an offset of the structure itself to the pointer...
20:42:52
stacksmith
In my SBCL it expands to (foreign-struct-slot-value ...) which in turn turns into (mem-ref ...)
20:46:00
stacksmith
I will restate my question: I have a custom way of doing this, but it seemed silly to have to define structures when CFFI already does that. Perhaps it's not so silly and I should continue without using CFFI for this.
20:59:50
stacksmith
fe[nl]ix: I can't figure out how much overhead it incurs as it goes deep into transforms and whatnot...
21:03:06
fe[nl]ix
stacksmith: use the default way and switch to a custom thing only if it proves to be slow, measurably
21:52:58
phoe
Does anyone have a macro that's like LET except it allows one to specify types for each variable as well?
22:07:59
Shinmera
I'm sure things like let+ and the three hundred other uber-let thingies can do that
22:09:03
phoe
yes. they seem to be much much more about destructuring than they are about typedness.