Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot) From: Erik Naggum <email@example.com> Date: 1997/04/23 Newsgroups: comp.lang.scheme,comp.lang.scheme.scsh,comp.lang.lisp,comp.lang.tcl,comp.lang.functional,comp.lang.c++,comp.lang.perl.misc,comp.lang.python,comp.lang.eiffel Message-ID: <firstname.lastname@example.org> * David Hanley | Ok, so you found one example on one CPU. Great. Do you have any others? amusing rejoinder. | Accusing someone of being stupid, and making stupid arguments oneself | does make someone look like a fool though; though it's not who you're | insulting. actually I don't generally accuse people of being stupid. I demonstrate it. you, however, keep accusing people of being stupid, among a lot of other irrelevant accusations. | > (defun foo (x y) (declare (fixnum x y)) (+ x y)) | > | > 0: cmp %g3, #x2 | > 4: tne %g0, #x13 | > 8: taddcctv %g0, %g1, %g0 | > 12: sra %o0, #x2, %o0 | > 16: sra %o1, #x2, %o1 | > 20: add %o0, %o1, %o0 | > 24: ld [%g4 + 135], %g2 ; fixnum-or-bignum | > 28: jmp %g2 + 0 | > 32: xor %g0, #x1, %g3 | I'm glad that the usual C compiler will not produce the preceeding code. | I'm glad the usual java compiler will not produce the preceeding code. | First of all, it specifies fixnums, but appears to be performing the | computation for all types--nice optimization. the incoming arguments are in %o0 and %o1. they are shifted right two bits because the type tag is in the two least significant bits. (actually, they are in the lowest _three_ bits, but even and odd integers have different type tags that conveniently overlap with the least significant bit of the value. I told you tagged pointers were optimized in Lisp.) the result is added together, and then that value is passed to a system function that builds a bignum if necessary (i.e., the most significant bit, apart from the sign bit is 1). | And testing the number of parameters is only necessary due to the | structure of lisp--berating C compilers for not doing this is silly. again, you demonstrate a belligerent ignorance that is just astonishing. what's wrong with asking whether it can be turned off? here's the same function, now compiled with (declaim (optimize (speed 3) (safety 0))) in effect: 0: add %o0, %o1, %o0 4: mov #x1, %g3 8: jmp %o7 + 8 12: nop note that this does not handle bignums, but it does return the number of return values to the continuation. it does not handle bignums because I specified fixnum arguments, and I'm assumed to know what I'm doing if I use (safety 0). note that this is the same as C cannot escape. I've had my Lisp system crash with bad code compiled with (safety 0), but otherwise not. I can't force a failing C program not to crash by tweaking a simple declaration! | Also, it appears that the whole function ought to be compiled to a single | tail-recursive jump or inlined for that matter. looks to me like the function it could have jumped to _is_ inlined. note that the fixnum-or-bignum function is used by a lot of other functions. | Perhaps you could try counting to 100 before responding to someone on the | net? The time might be used to actually think about what you're posting, | which might work wonders. how far did you count? | > Bastard Sex Therapist from Hell: "Read the F*cking Manual!" | | A freudinan message?? OK, so let's try another one. #\Erik -- if we work really hard, will obsolescence be farther ahead or closer?