freenode/lisp - IRC Chatlog
Search
20:02:17
aeth
IMO... You almost never want subseq except at the last stage of an operation (e.g. when you want to turn an adjustable string you just built up with vector-push-extend into a regular simple-string of a fixed length)
20:02:59
aeth
Almost everything for vectors/sequences should have start/end which should be used for vectors (including strings) until that point. If the API doesn't, patch it to!
23:22:39
_death
also, as far as I can tell, LOGCOUNT is a Common Lisp innovation (and its initial name was likely COUNT-BITS).. the pitmanual only shows 4 logxxx operators
6:12:44
mfiano
Implementation must only obey the declaration identifiers NOTINLINE, SPECIAL, and conform to some OPTIMIZE/SAFETY rules
6:17:23
aeth
This is why I'm going to eventually put in the work to change the default behavior of my DEFINE-FUNCTION macro to be implementation-specific: i.e. DECLARE when it works (* unfortunately in SBCL with (safety 0) imo it doesn't "work" and I don't think there's a way to detect that) and CHECK-TYPE when DECLARE is ignored
6:17:57
aeth
But short of putting in too much effort writing a macro that does both DECLARE and CHECK-TYPE, if you must have it checked as a priority use CHECK-TYPE and assume DECLARE is for optional performance.
6:31:08
jackdaniel
sbcl adds declare /type/ and check-type are independent spec wise. sbcl indeed usually adds check-type, but that's its custom safety policy
6:32:45
aeth
SBCL's DECLARE (when not (safety 0)) has afaik two distinctions from CHECK-TYPE. (1) you cannot provide an object at runtime that satisfies the type if you give an object of the wrong type, which probably speeds things up a tiny bit; and, (2) it gives information for type inference and a bit of static checking
6:33:23
aeth
(with CHECK-TYPE, it infers that the object in the variable before that point is of type T since it can be anything and the user can just provide something of the correct type after that point)
6:36:21
aeth
It's a bit confusing, but beyond this, SBCL internally distinguishes between an inferred type and a declared type, which can differ. The only place where this is really exposed in a convenient way is in SLIME's debugger, but there are probably some internal functions for that.
6:43:38
aeth
Oh, and it also does the DECLARE type check at a different point in the function, before the output of the standard DISASSEMBLE, which you can only see with sb-disassem:disassemble-code-component.
6:43:56
aeth
This is its typecheck for LIST when doing CAR... notice how it's only in the second disassemble:
6:44:00
aeth
(format t "Standard disassemble of CAR~%~%") (disassemble #'car) (format t "~%Full disassemble of CAR~%~%") (sb-disassem:disassemble-code-component #'car)