Sean Ross | 2 Jun 18:01 2003
Picon

Type Checking


In this code

(defun foo (x)
  (list x))

(defun bar (x)
  (+ x (foo x)))

is it possible to get the compiler to
complain about the result of (foo x)  being
a list and not a number without resorting
to (declare ftype) statements?

I'm trying with this compilation policy
COMPILATION-SPEED = 1
DEBUG = 1
SAFETY = 3
SPACE = 1
SPEED = 1
INHIBIT-WARNINGS = 0

Thanks

  Sean.

-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
(Continue reading)

Eric Marsden | 2 Jun 18:50 2003
Picon
Picon

Re: Type Checking

>>>>> "sr" == Sean Ross <sdr <at> jhb.ucs.co.za> writes:

  sr> (defun foo (x)
  sr> (list x))
  sr> 
  sr> (defun bar (x)
  sr> (+ x (foo x)))
  sr> 
  sr> is it possible to get the compiler to complain about the result
  sr> of (foo x) being a list and not a number without resorting to
  sr> (declare ftype) statements?

CMUCL knows this; it says

,----
| ; File: /tmp/warn.lisp
| ; In: defun bar
| ;   (foo x)
| ; Warning: Result is a list, not a (values &optional number &rest t).
`----

SBCL doesn't warn (clearly because they've been fiddling too much with
the compiler :-).

--

-- 
Eric Marsden                          <URL:http://www.laas.fr/~emarsden/>

-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
(Continue reading)

Christophe Rhodes | 2 Jun 19:18 2003
Picon
Picon

Re: Type Checking

Sean Ross <sdr <at> jhb.ucs.co.za> writes:

> In this code
>
> (defun foo (x)
>   (list x))
>
> (defun bar (x)
>   (+ x (foo x)))
>
>
> is it possible to get the compiler to
> complain about the result of (foo x)  being
> a list and not a number without resorting
> to (declare ftype) statements?

The short answer is "yes, it is": set SB-EXT:*DERIVE-FUNCTION-TYPES*
to T before compiling your code.

To see why this isn't the default, consider that until you call BAR,
you don't know which function named FOO will be called.  Some other
code later on could redefine FOO as (defun foo (x) 1), and then your
code would not be in error any more.

There is latitude for a compiler to treat functions within the same
compilation unit (often established by COMPILE-FILE) as referring to
the same functions, I think; might it be reasonable to bind
*DERIVE-FUNCTION-TYPES* in the macroexpansion of
WITH-COMPILATION-UNIT, I wonder?

(Continue reading)

XenWryla LeFae | 9 Jun 18:10 2003

Lisp Newbie

Hello lispers,

For something like a year now my realtionship with lisp has been like
the relationship the loser flunkie from across the tracks has with the
prom queen.  From afar I have read nearly everything from
Parenthetically Speaking, most of Paul Graham's articles, and lots of
other stuff.

The funny thing is that I haven't sought this relationship, functional
programming in general and lisp specifically have been insidiously
inserting themselves into my brain.  I read the above articles
folloing chains of recommendations and links and one day noticed that
I was reading all this stuff either about lisp or by lispers.

So I am a self-taught zoper and pythoner these days.  I have studied a
few lisp tutorials as far as I realistically can without having an
itch to scratch to drive me further.  Now I have an itch to scratch,
it is a web app that I have been wanting to make for sometime.  I
believe a functional language would be well suited to it and lisp is
my choice.  I'm getting tired of some of the failings in zope and so
would like to take this as an opportunity to get over the hump with
lisp.

My question is this, what is going to be the easiest way to get up and
running doing web programming in lisp so that my learning curve is as
flat as possible?  What existing frameworks can anyone recommend?
Libraries?  Lisp-CGI stuff?  Stand alone lisp web server?  Persistence
in lisp?  My goal at this point is to start with a setup that will get
me seeing the results of my initial forays sooner rather than later.
Once I'm up to speed, then I can learn more powerful setups that might
(Continue reading)

Christophe Rhodes | 9 Jun 18:38 2003
Picon
Picon

Re: Type Checking

Eric Marsden <emarsden <at> laas.fr> writes:

>>>>>> "sr" == Sean Ross <sdr <at> jhb.ucs.co.za> writes:
>
>   sr> (defun foo (x)
>   sr> (list x))
>   sr> 
>   sr> (defun bar (x)
>   sr> (+ x (foo x)))
> CMUCL knows this; it says
>
> ,----
> | ; File: /tmp/warn.lisp
> | ; In: defun bar
> | ;   (foo x)
> | ; Warning: Result is a list, not a (values &optional number &rest t).
                                               ^^^^^^^^^^^^^^^^

That doesn't look like the optimal type to be asserting; (VALUES) is a
(VALUES &OPTIONAL NUMBER &REST T), but isn't suitable as an argument
to  #'+.  (It's possible that CMUCL's internal type is correct, but
then the note is wrong :-).

> SBCL doesn't warn (clearly because they've been fiddling too much with
> the compiler :-).

With a little fiddling to the compiler, sbcl-0.8.0.54 now warns for a
file containing
  (defun foo (x) (list x))
  (defun bar (x) (1+ (foo x)))
(Continue reading)

Eric Moncrieff | 9 Jun 21:34 2003

Trouble compiling 0.8.0 under Gentoo Linux x86...

Hello All,

Thinking I'd test out the new threading stuff, I decided to compile
SBC 0.8.0 and try them out.  I downloaded the source, unpacked it and,
following the INSTALL instructions, created a
customize-target-features.lisp, with the following entry:

(lambda (list)
  (adjoin :sb-thread list))

Then I did 'sh make.sh', as suggested.  This eventually bombed with
the message below.

Any ideas where to go with this?

Thanks,
Eric

Message follows:
...

Doing 18 pending tests of 18 tests total.
 SB-BSD-SOCKETS:MAKE-INET-ADDRESS
 SB-BSD-SOCKETS-TEST::MAKE-INET-ADDRESS2
 SB-BSD-SOCKETS:MAKE-INET-SOCKET
 SB-BSD-SOCKETS-TEST::MAKE-INET-SOCKET-KEYWORD
 SB-BSD-SOCKETS-TEST::MAKE-INET-SOCKET-WRONG
 SB-BSD-SOCKETS-TEST::MAKE-INET-SOCKET-KEYWORD-WRONG
 SB-BSD-SOCKETS-TEST::NON-BLOCK-SOCKET
 SB-BSD-SOCKETS-TEST::INET-SOCKET-BIND
(Continue reading)

Daniel Barlow | 9 Jun 21:55 2003
Picon

Re: Trouble compiling 0.8.0 under Gentoo Linux x86...


Eric Moncrieff <eric+sbcl <at> styx.org> writes:

> Then I did 'sh make.sh', as suggested.  This eventually bombed with
> the message below.

Do you have a world-writable /dev/log socket?  Is syslogd running?
That seems to be the cause of the sb-bsd-sockets failure, anyway.  I
don't know what the simple-streams issue is

It's hard to test networking code without something for it to talk to.
I'm going to take this test out in 0.8.1. 

> Any ideas where to go with this?

The build hasn't actually bombed; it just aborted that particular
contrib module and carried on.  You can 

(a) ignore it; sb-bsd-sockets will not be installed (this will
be a problem if you want to use stuff like aserve or clx that sdepends
on it), or 

(b) touch contrib/sb-bsd-sockets/test-passed to pretend it worked
(after all, it probably does), then sb-bsd-sockets will be installed.

Now go ahead and run install.sh in whatever way INSTALL says it should
be run

-dan

(Continue reading)

Rudi Schlatte | 9 Jun 22:13 2003
Picon

Re: Trouble compiling 0.8.0 under Gentoo Linux x86...


Daniel Barlow <dan <at> telent.net> writes:

> Do you have a world-writable /dev/log socket?  Is syslogd running?
> That seems to be the cause of the sb-bsd-sockets failure, anyway.  I
> don't know what the simple-streams issue is

The same -- the only dual-channel simple stream that's implemented is
a socket stream, so that's what gets used for testing.

Rudi
--

-- 
whois DRS1020334-NICAT                    http://constantly.at/pubkey.gpg.asc
     Key fingerprint = C182 F738 6B9A 83AF 9C25  62D9 EFAE 45A6 9A69 0867
Eric Moncrieff | 10 Jun 01:05 2003

Re: Trouble compiling 0.8.0 under Gentoo Linux x86...


:* Rudi Schlatte writes:

 | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

 | Daniel Barlow <dan <at> telent.net> writes:

 || Do you have a world-writable /dev/log socket?  Is syslogd running?
 || That seems to be the cause of the sb-bsd-sockets failure, anyway.
 || I don't know what the simple-streams issue is
 | The same -- the only dual-channel simple stream that's implemented
 | is a socket stream, so that's what gets used for testing.

And, in fact, you were both right...So I can a) report that SBCL 0.8.0
compiles on Gentoo/x86, using SBCL 0.7.7 as host compiler, and b)
syslog-ng under Gentoo doesn't play nice with it.

Thanks for the quick response.

Eric
** 
Eric Moncrieff                                    eric <at> mantis.styx.org

"You turned out okay...Sort of."
                            --Innie Chen, on me
**
                This space intentionally left blank.
Mario Mommer | 9 Jun 18:46 2003
Picon
Picon

Re: Lisp Newbie


You might want to start here:

http://lisp.t2100cdt.kippona.net/lispy/home

Regards,
        Mario.

XenWryla LeFae <xen <at> lefae.org> writes:
> Hello lispers,
> 
> For something like a year now my realtionship with lisp has been like
> the relationship the loser flunkie from across the tracks has with the
> prom queen.  From afar I have read nearly everything from
> Parenthetically Speaking, most of Paul Graham's articles, and lots of
> other stuff.
> 
> The funny thing is that I haven't sought this relationship, functional
> programming in general and lisp specifically have been insidiously
> inserting themselves into my brain.  I read the above articles
> folloing chains of recommendations and links and one day noticed that
> I was reading all this stuff either about lisp or by lispers.
> 
> So I am a self-taught zoper and pythoner these days.  I have studied a
> few lisp tutorials as far as I realistically can without having an
> itch to scratch to drive me further.  Now I have an itch to scratch,
> it is a web app that I have been wanting to make for sometime.  I
> believe a functional language would be well suited to it and lisp is
> my choice.  I'm getting tired of some of the failings in zope and so
> would like to take this as an opportunity to get over the hump with
(Continue reading)


Gmane