freenode/#lisp - IRC Chatlog
Search
13:28:10
phoe
jackdaniel: I screwed up. I did not format the comment that I inserted properly and I did not re-test the build after inserting the comment.
13:29:24
jackdaniel
ACTION tries to look unsuspiciously and pretend that he didn't merge a broken commit.
13:34:18
jackdaniel
truth to be told mere illusion of someone looking into things creates a backpressure to "make things right"; I'm not saying it is an illusion in this case of course
13:35:52
pfdietz
Complaining that mutation can make a SATISFIES type declaration no longer hold is the same as complaining that RPLACA can make a CONS type declaration no longer hold.
13:36:57
phoe
the way I understand it, SATISFIES can return arbitrary values on each call of the predicate
13:38:21
pfdietz
I generate (SATISFIES EVAL) in some random tests of type propagation. Have to make sure the thing being checked is not a cons or symbol.
13:39:56
phoe
SATISFY denotes the set of all objects that satisfy the predicate predicate-name, which must be a symbol whose global function definition is a one-argument predicate.
13:42:31
minion
Bike, memo from phoe: we screwed up. CLHS SATISFIES describes the type specifier as: "denotes the set of all objects that satisfy the predicate predicate-name, which must be a symbol whose global function definition is a one-argument predicate."
13:42:31
minion
Bike, memo from phoe: but a quick (defun foo (x) (declare (ignore x)) (= 1 (random 2))) and the same for foo2 bar bar2 fix that issue.
13:42:32
minion
Bike, memo from phoe: OK, here is the first rough draft of my range-merging hack. https://plaster.tymoon.eu/view/1557#1557 Works on CCL, should work on SBCL with minor modifications.
13:43:19
jackdaniel
phoe: we work on a definition you've mentioned now, error never returns generalized boolean
13:43:38
phoe
jackdaniel: yes, you are correct in that case - a function can't return a genbool if it can't return
13:43:40
Bike
if there's an implementation of subtypep that actually looks for function definitions i'd be surprised
13:44:23
phoe
I would actually be unsurprised if an implementation on high safety checked if these functions exist at typecheck-time and signaled errors if they didn't
13:45:44
pfdietz
A def-type-predicate macro, that defines predicates for use in satisfies, but in way that allows the type system to reason about the definitions, could be useful.
13:47:37
phoe
anyway, I'm munching on the CCL type system to see where I can inject my range-checking stuff.
13:48:33
phoe
and in case you're up for more fun, https://github.com/Clozure/ccl/issues/252 evolved into yet another edge case after your yesterday fix
13:48:36
pfdietz
Another thing I'd like to see in CL is something like "if this function is called with arguments of types T1, T2, ... it returns something of type R."
13:49:54
Bike
so you'd define the type of car as (generic (function (null) null) (function (cons) t)) or something
13:50:09
phoe
you'd need the compiler to support that sorta thing so it can utilize that knowledge in its type inference engine
13:50:34
pfdietz
Right. One might even have parameterization: when called on (CONS ?X T), return ?X.
13:53:22
Bike
the more stuff like this the more uncomputable type operations get. lips's starts out more uncomputable than most, but still
13:55:17
Bike
for example if you defined foo to have type (forall x (function (x) (cons t x))), then did (loop until (condition) do (setf x (foo x))), inferring the type of x afterward would be kind of a journey, and you'd probably need something to give up and pick cons
13:57:49
Bike
jackdaniel: i mean in this case the idea would be defining multiple input output relationships, since CL already lets you describe one relationship overall
14:00:34
jackdaniel
regarding arg-types -> result-type I'm sure it would be possible to add something for non-standard generic functions, but that would be limited to classes -- imho a good thing
14:01:08
Bike
well in this case it wouldn't have any semantic effect, just be information for the compiler to use
14:02:25
trittweiler
There's define-api in named-readtables which expands to an ftype declaim for the functions exported from the package. (With a nicer syntax, in my opinion, because it takes the type signature separately instead of convoluting it into the parameter list.) The ftype declaration is nice because it lets sbcl often find type mismatched on compile-time.
14:02:29
jackdaniel
but then you'd either need to check the resulting type anyway or trust it foolhardily (like with invalid declarations)
14:03:15
Bike
yeah but that's true with any type declaration. this would just let you get more specific declarations, hopefully
14:56:20
pjb
ebrasca: optimizing compilers already transform (* 3 x x) into (let ((reg (* x x))) (+ reg reg reg)) !!!
14:56:49
pjb
ebrasca: try it in sbcl, I wouldn't be surprised that both (* 3 x x) and (+ (* x x) (* x x) (* x x)) compile to the same thing.
15:01:26
jackdaniel
or if you hire a person to rewrite the code, in this spirit we could say that any compiler optimizes anything into whatever, because it may be rewritten by some tool or a person ,)
15:02:18
jackdaniel
I wouldn't split that hair in four but some people do it a lot, so I thought I'll join the party
15:12:09
jackdaniel
I don't think that quicklisp is a sane requirement for testing gcc optimizations (also ditto, "in this spirit we could…")
15:13:53
pjb
jackdaniel: use the lisp REPL as a shell! No choice anyways, chsh /usr/local/bin/ccl has been done.
15:15:25
jackdaniel
^ completely fails as the argument for the thing discussed (a is b because c, but hey, you may z) - I had my share of entertainment, see you \o
15:16:05
pjb
jackdaniel: I demonstrated that gcc has no problem compiling (* 3 x x) if you use linc as pre-processor!
15:16:49
pjb
jackdaniel: and as the maintainer of ecl, you should be ashamed of your objection, since ecl compiles (* 3 x x) with gcc!!!
15:45:08
PuercoPope
jasom: One of the main problems I've encountered with JSCL is that it needs 'run-time' support for mapping CL objects to the semantics of JS. You mentioned the numeric tower, bit-vectors also come to mind. Given that wasm can also export functions to the host (JS in the case of browsers), what do you think of using wasm to implement things like integer arithmetic and have JSCL rely on them?
16:33:14
reepca
Is there a way for initforms in DEFSTRUCT to refer to each other? For example, I've got a queue struct and it needs the tail to initially be the head, and the head to initially be a fresh cons cell
16:35:00
Shinmera
you can use the :constructor and make the tail be &optional, referring to the head.
17:15:48
jackdaniel
pjb: essentially what you say is falsehood, A + B = B; where A is not 0 (licn + gcc = gcc), so it doesn't, well, add up. when you take everything verbatim at least make your claims logical
19:17:40
jasom
PuercoPope: that's fairly reasonable, as is having JSCL compile to an IR and have WASM interpret the IR.
19:23:35
PuercoPope
jasom: The 'IR' (or would AST be more accurate) is fairly close to JS and depends on having its data-types. Don't think it would be easy to write a wasm interpreter for that