libera/commonlisp - IRC Chatlog
Search
23:13:30
Psybur
anybody know of a general sql parser that can let me work with ASTs? one that can not completely choke a non standard dialect?
7:23:05
hayley
I only actually have one copy, but I had both my own copy, and had borrowed the university copy for a short period of time.
7:24:17
hayley
Coming up on having borrowed the Garbage Collection Handbook without interruptions for a year. Richard Jones told me if I hold out for a few more months, I could get the new edition.
7:27:20
hayley
Well, I hope it's a year. I have the little slip of paper that fell out, with "PATTON, HAYLEY 19.07.21" written on it, but the online system says I borrowed it on the 14th. Granted, it took a week for the library to find the book.
8:32:58
beach
rendar: The garbage-collection handbook? Sure, if you are interested in automatic memory management. It has a description of all the major techniques and their characteristics. And there is no other book like it.
8:32:59
hayley
AMOP or the GC Handbook? I only bought the former, but the latter would be a good investment too.
8:33:44
beach
rendar: However, it is not very well written, though perhaps the new edition will be better. I suspect not, however.
8:33:51
hayley
Though, yes, as beach says, the latter is only useful if you want to work with garbage collection.
8:34:46
hayley
The description of the Lisp-2 compaction algorithm is going to be better in the new edition, at least.
8:37:06
hayley
Yeah, I often found I needed to look at the papers cited in order to understand what was going on. But having those references is also useful.
8:37:59
beach
hayley: Of course, now that I think about it... I often say that I think that in order for someone to be a good programmer, that someone needs to know about computer architecture and compiler techniques. Maybe I should add "memory management (automatic or manual)" to that list.
8:38:54
hayley
In particular, I can never remember the name "Java server performance: a case study of building efficient, scalable Jvms" which is relevant to my current work. The paper on Immix cites a website by IBM that does not exist anymore, but the GC Handbook cites that article instead.
8:40:04
beach
rendar: But it is a very important book. Alan Kay said it was one of the most important CS books ever written, or something to that effect.
8:41:46
hayley
On the other hand, he said it was hard to read if you weren't familiar with Lisp. Which I can understand, honestly, as I think Dylan would have been the only other language with generic functions, in 1997.
9:06:11
hayley
In a Hacker News comment, Alan Kay also gave the praise "I liked the MOP book because they carried the model more deeply into the actual definitions -- I very much liked their metaphor that you want to supply a "region of design and implementation space" rather than a single point."
9:28:28
pjb
beach: (let ((&allow-other-keys 10) (x 20)) (write &allow-other-keys x)) #| ERROR: Incorrect keyword arguments in (20) . |#
9:34:04
_death
pjb: this error has nothing to do with the &allow-other-keys.. (maybe you confused it with :allow-other-keys)
9:48:51
_death
also happily, beach's idea of renaming seems fine, because &rest etc. cannot be declared special by the user.. though I guess if there are some implementation-specific lambda-list-keywords it may be an issue (but sbcl has a package lock on sb-int:&more, so no issue there)
10:10:06
TMA
I cannot find whether it is specified for &rest etc. to be present or accessible in the COMMON-LISP package.
10:11:55
specbot
Symbols in the COMMON-LISP Package: http://www.lispworks.com/reference/HyperSpec/Body/01_i.htm
10:12:12
specbot
The COMMON-LISP Package: http://www.lispworks.com/reference/HyperSpec/Body/11_aba.htm
10:15:31
TMA
ah, I was a bit baffled by the glossary entry "lambda list keyword n. a symbol whose name begins with ampersand and that is specially recognized in a lambda list."
10:17:31
TMA
that has two readings, namely that (a) the &-beginning-symbol is specially recognized in a lambda list and (b) that the &-beginning-symbol's name is specially recognized in a lambda list.
10:19:22
TMA
the (b) reading would allow (lambda (&rest x) x) and (lambda (#:&rest x) x) be equivalent (in the same spirit as the loop keywords are specified by name only)
10:19:46
_death
it's a conjunction.. it has to (i) begin with an ampersand (ii) be specially recognized in the lambda list
10:25:12
TMA
lambda-list-keyword(x) === (let ((that ...)) (and (eql (elt (symbol-name x) 0) #\&) (specially-recognized-in-a-lambda-list-p that)))
10:26:16
_death
I can see how you could read it as "a symbol whose name (begins ... and that is specially recognized ...)" but only if you remove the context of lambda list parsing as described in the clhs
10:28:53
nij-
phoe I bought a phys copy of your book on condition system. It's great so far :D Thanks!
10:31:33
TMA
_death: well, I can argue against myself that the wording in 6.1.1.2 Loop Keywords is explicit enough that the intended meaning is not the .../(symbol-name x) substitution, because there is not enough of similarly explicit wording for lambda list keywords
10:32:50
nij-
1. I wonder why can't we use if/case forms to handle different conditions. Isn't that simpler?
10:32:54
nij-
2. I've heard many times that Lisp's condition system is better than other langs'. However, Python for example has a debugger too. In what way is the Lisp condition system better than Python's (or any other lang's)?
10:33:02
nij-
3. You mentioned that *-bind are macros but not functions (chapter 4) and therefore cannot be operated functionally. While macros are great for extending Lisp syntax, does this show that macros have their (serious?) limits too?
10:33:20
TMA
but the specification lawyer in me cringes, I have been trained to spot those minor ambiguities in standards; it turns out those are lagely intentional loopholes
10:33:49
_death
lambda-list-keywords is a constant variable that contains a list of all the lambda list keywords.. if the definition had been about names, it'd be hard to cons :)
10:36:41
TMA
"A list of all the lambda list keywords used in the implementation, including the additional ones used only by macro definition forms."
10:37:43
TMA
it still keeps a bit of wiggle room for symbols that are recognized by the implementation but not used in it
10:44:15
pjb
TMA: note: (defun specially-recognized-in-a-lambda-list-p (x) (member x lambda-list-keywords))
10:44:55
pjb
TMA: so really the &-beginning-symbol-p in the definition is only a constraint on what is in lambda-list-keywords.
10:45:32
pjb
TMA: so you're right that a #:&REST or a SI:&REST symbol could be in lambda-list-keywords, but we've never seen them. (implementation dependent).
10:45:56
pjb
Alsok it would be hard to use #:&REST since you'd have to find it in lambda-list-keywords for reference.
10:46:06
hayley
Not phoe but: #1 Conditions are "non-local" in that they interact with code that isn't nested in the forms, like IF and CASE do. 2. The debugger isn't that important in itself, but not unwinding and losing information is important. And (from memory) pdb and similar for Java unwind too much, before entering the debugger. 3. handler-bind and such cannot be functions (while otherwise retaining the same interface), because those forms affect the
10:47:03
_death
I think TMA is imagining an implementation that has a lambda-list-keyword-p function that checks a symbol's name.. then why provide a lambda-list-keywords list and not such a function to the user?
10:48:00
nij-
hayley - thanks: 1. In general we should prevent writing nonlocal codes. It makes me more curious why in some case we choose to use conditions/handlers instead of if/case.
10:48:46
nij-
hayley 2. What does "unwind" mean? What makes those languages unwind and lose too much info?
10:49:07
lisp123
and control flow for say _exceptional_ circumstances to flow through the condition system
10:49:23
hayley
Should we? Dynamic variables are the same sort of thing, that passing information through e.g. function arguments is cumbersome. Similarly handling situations "locally" can get cumbersome.
10:49:37
pjb
_death: the difference in information is: (let (lambda-list-keywords) (do-symbols (s) (if (lambda-list-keyword-p s) (push s lambda-list-keywords))) lambda-list-keywords)
10:49:38
nij-
hayley 3. Yeah, in general many things cannot be functions. So while macros are great, that's one of their limit, isn't it?
10:50:28
hayley
Unwinding means to abandon evaluation of some evaluation. What RETURN-FROM, THROW, etc do.
10:51:15
hayley
nij-: It's more a limit of functions at face value, that for a function application, all arguments are evaluated before the function is called, so a function has no control of how arguments are evaluated.
10:51:21
_death
pjb: the point is that you may want to write a program (say, a code walker) that has to deal with certain lambda list keywords.. if you then find a symbol that's a lambda list keyword that you don't handle, you can signal an error.. so if lambda-list-keywords is not exhaustive, it's not very useful
10:52:35
nij-
lisp123 why do we want the exceptional circ. to flow through the cond. system not if/case?
10:53:30
nij-
hayley: But macros, on the other hand, are not first class citizens. We can not apply things on them..
10:53:46
lisp123
nij-: because for errors or other exceptional situations, by cleanly segregating the code that handles the normal "business" case and the error case, it is easier to flow through a program and understand what it does
10:54:21
lisp123
you very much want to consider errors on their own and then the main program on its own and then at a combined level how the error protection helps make your program more robust (although jury is out on that one)
10:54:27
nij-
lisp123 ! I think that makes sense. Yeah, if I use if/case ordinarily, the main body will be crowded with exception handlings.
10:54:56
lisp123
but its good you are thinking about these things, because now you will be better at making that judgement on when to use what
10:54:56
hayley
Sure, they are not first class, but what you are asking for isn't well formed. FUNCALL and APPLY will be called with values that were produced by evaluating other forms. Macros process unevaluated forms.
10:57:35
hayley
Macro functions are functions, and thus in turn objects. But macros are used before evaluation (though the macro function is called, causing more evaluation), whereas functions are used in evaluation.
10:58:08
lisp123
its hard to understand macros vs functions as a beginner and then one day it clicks
10:58:41
lisp123
if you remember that macros are used to create new syntax, thats a good heuristic to guide you
10:59:01
nij-
I know that macros do not eval their args.. just curious what we can apply on macros meaningfully.
10:59:04
lisp123
i.e. if you have lots of code repeat or annoying function calls, a macro may be the answer
10:59:20
jackdaniel
it's simple, macros are expanded by the preprocessor, that's how we can define operators that accept any kind of arguments!
11:01:24
nij-
In C we cannot apply on functions.. and that's not too convenient. I'm trying to ask if such case is for macros too.
11:02:05
jackdaniel
nij-: you can't apply "on" a macro, because that would require evaluating the argument