Subject: [clisp-list] poll: DELETE-FILE return value

From: Sam Steingold <[email-masked]>
Date: Tue Feb 17 10:06:02 2004

In ANSI CL, DELETE-FILE is specified to return T on success.
CLISP returns the truename of the deleted file.
This is not compliant, albeit it offers a nice feature.

How is this to be fixed?

1. just return T and forget the truename

2. return T when *ANSI* is T and truename otherwise.
   (I think introducing an extra user variable for this is silly)

3. ignore the ANSI spec and keep the current behavior

4. other options?

please voice your opinions here on <clisp-list>, if you do not,
my prejudice will be hoisted on you.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
If abortion is murder, then oral sex is cannibalism.

---

From: "John K. Hinsdale" <[email-masked]>
Date: Tue Feb 17 10:38:13 2004

>    (I think introducing an extra user variable for this is silly)

Yes: preserves existing code that relies on the truename and at the
same time and guarantees ANSI-compliant when -ansi used ...

 > 1. just return T and forget the truename

No, will break existing code (run w/out -ansi) that relies on the
truename

 > 3. ignore the ANSI spec and keep the current behavior

No, fails ANSI-compliance

 > 4. other options?

If this were perl, it'd have to behave differently based on whether
DELETE-FILE was called in a "boolean context" -- except when running
in ANSI perl mode :)

---

From: Marco Antoniotti <[email-masked]>
Date: Tue Feb 17 11:14:10 2004

On Tuesday, Feb 17, 2004, at 13:00 America/New_York, Sam Steingold 

> 1. just return T and forget the truename

If the truename refers to a delete file what use can you have?

>    (I think introducing an extra user variable for this is silly)

Nope.

> 3. ignore the ANSI spec and keep the current behavior

Absolutely not.

> 4. other options?

Return T and the truename as a second value.

marco

--
Marco Antoniotti					http://bioinformatics.nyu.edu
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.

---

From: Marco Antoniotti <[email-masked]>
Date: Tue Feb 17 11:16:02 2004

On Tuesday, Feb 17, 2004, at 13:32 America/New_York, John K. Hinsdale 

> No, will break existing code (run w/out -ansi) that relies on the

Existing CLisp code already breaks in ANSI implementations.

Cheers

---

From: Marco Antoniotti <[email-masked]>
Date: Tue Feb 17 11:23:01 2004

On Tuesday, Feb 17, 2004, at 14:10 America/New_York, Marco Antoniotti 

> Existing CLisp code already breaks in ANSI implementations.

Obviously with all the caveats and distinguos of the case.

Cheers

---

From: Raymond Toy <[email-masked]>
Date: Tue Feb 17 11:54:12 2004

>>>>> "Sam" == Sam Steingold <[email-masked]> writes:

    Sam> In ANSI CL, DELETE-FILE is specified to return T on success.
    Sam> CLISP returns the truename of the deleted file.

Where does it say T?  From the CLHS, I see that the syntax part says
delete-file returns T, but in the description it says:

   delete-file returns true if it succeeds, or signals an error of
   type file-error if it does not.

Where "true" basically means not NIL.

Ray

-- 
--

-- 
Ericsson may automatically add a disclaimer.  Sorry, it's beyond my
control.


This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.

---

From: Sam Steingold <[email-masked]>
Date: Tue Feb 17 12:01:03 2004

> * Marco Antoniotti <[email-masked]> [2004-02-17 14:08:34 -0500]:
>

I do not understand this question.

> Return T and the truename as a second value.

this is not compliant either.
DELETE-FILE returns 1 value.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Whether pronounced "leenooks" or "line-uks", it's better than Windows.

---

From: Sam Steingold <[email-masked]>
Date: Tue Feb 17 12:03:05 2004

> * Marco Antoniotti <[email-masked]> [2004-02-17 14:18:03 -0500]:
>

I do not understand these two sentences.
Could you please elaborate?
(neither of us is a native English speaker :-)

My other CAR is a CDR.

---

From: Paolo Amoroso <[email-masked]>
Date: Tue Feb 17 12:06:03 2004

> This is not compliant, albeit it offers a nice feature.
[...]
> 2. return T when *ANSI* is T and truename otherwise.

This is my preference.

Paolo
-- 
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film

---

From: Sam Steingold <[email-masked]>
Date: Tue Feb 17 12:17:03 2004

> * Raymond Toy <[email-masked]> [2004-02-17 14:48:43 -0500]:
>

Yes, so the current CLISP behavior is "weakly compliant" :-)
Trouble is, it does say literal T in the syntax section...

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Only adults have difficulty with child-proof caps.

---

From: Marco Antoniotti <[email-masked]>
Date: Tue Feb 17 12:28:01 2004

On Tuesday, Feb 17, 2004, at 14:56 America/New_York, Sam Steingold 

> (neither of us is a native English speaker :-)

I just felt that my first email was wrong.  I guess I made things worse 
with my second one :)  I meant that if you had already written 
something like

	(let ((ftn (delete-file "foo")))
	   ... do something with FTN as a truename ...)

then you are already on thin ice.

Marco

---

From: Marco Antoniotti <[email-masked]>
Date: Tue Feb 17 12:37:05 2004

On Tuesday, Feb 17, 2004, at 14:55 America/New_York, Sam Steingold 

> DELETE-FILE returns 1 value.

A conformant program would not break.  But then again a conformant 
program would not break either if you returned the truename as first 
value.   But wait maybe if somebody did

	(let ((d (delete-file "foo")))
	   (etypecase d
	       (symbol ...)
	       ))

It never ends!   :{

Cheers

---

From: zera holladay <[email-masked]>
Date: Tue Feb 17 12:38:02 2004

> > * Raymond Toy <[email-masked]> [2004-02-17

If it is "weakly compliant", then how is T defined?  I
thought T is a superclass of everything that is not
'(), or at least I think I remember Steele writing
something like that?

-zh

-------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps
> Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
>
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> clisp-list mailing list
> [email-masked]
>
https://lists.sourceforge.net/lists/listinfo/clisp-list

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

---

From: Sam Steingold <[email-masked]>
Date: Tue Feb 17 12:47:07 2004

> * Marco Antoniotti <[email-masked]> [2004-02-17 15:32:18 -0500]:
>

???

> A conformant program would not break.

(length (multiple-value-list (delete-file foo)))
is conformant and must return 1 in a conforming implementation.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
There are 10 kinds of people: those who count in binary and those who do not.

---

From: Russell McManus <[email-masked]>
Date: Tue Feb 17 12:57:01 2004

> This is not compliant, albeit it offers a nice feature.

return two values.

-russ

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Tue Feb 17 12:57:06 2004

> my prejudice will be hoisted on you.

Actually, CLHS is ambiguous about the return of delete-file:

 delete-file filespec => t

 delete-file returns true if it succeeds, or signals an error of type
 file-error if it does not.

and the glossary:

 true n. any object that is not false and that is used to represent
 the success of a predicate test. See t[1].

What the rule about such cases yet?

It seems to me that returning non nil is good enough to be compliant.

Of course, a compliant (portable)  application would not use the value
returned by delete-file, so  perhaps it's not worth returning anything
else than t. On the other hand, for interactive use, it's nice. So I'd
say don't change anything. If it ain't broken...

-- 
__Pascal_Bourguignon__                     http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/

---

From: Sam Steingold <[email-masked]>
Date: Tue Feb 17 12:57:07 2004

> * Marco Antoniotti <[email-masked]> [2004-02-17 15:22:37 -0500]:
>
> I just felt that my first email was wrong.  I guess I made things
> worse with my second one :) I meant that if you had already written
> something like
>

indeed.

The general idea is that the _only_ reason to use -ansi or set *ANSI*
is to run an ANSI compliance suite.

One should set the 6 options
(http://clisp.cons.org/impnotes/ansi.html) one by one, as desired.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Time would have been the best Teacher, if it did not kill all its students.

---

From: Sam Steingold <[email-masked]>
Date: Tue Feb 17 13:01:12 2004

> * Russell McManus <[email-masked]> [2004-02-17 15:51:14 -0500]:
>

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
usually: can't pay ==> don't buy. software: can't buy ==> don't pay

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Tue Feb 17 13:02:07 2004

> No, will break existing code (run w/out -ansi) that relies on the

Which  would  be a  Good  Thing(tm)  IMO!   Since it's  implementation
dependant, I'd even move to  randomly return the truename, the size of
the file deleted, or the age of my grandmother.

> No, fails ANSI-compliance

What ANSI-compliance? CLHS is ambiguous and says it returns non nil!

---

From: Sam Steingold <[email-masked]>
Date: Tue Feb 17 13:04:11 2004

> * zera holladay <[email-masked]> [2004-02-17 12:33:01 -0800]:
>
> If it is "weakly compliant", then how is T defined?

<http://www.lisp.org/HyperSpec/Body/convar_t.html>

> I thought T is a superclass of everything that is not '(), or at least
> I think I remember Steele writing something like that?

<http://www.lisp.org/HyperSpec/Body/syscla_t.html>

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
All extremists should be taken out and shot.

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Tue Feb 17 13:13:26 2004

> (http://clisp.cons.org/impnotes/ansi.html) one by one, as desired.

I  _always_ run clisp  with -ansi.   The general  idea being  to write
portable code.  I like very much  clisp, but I don't want to be locked
on it.

---

From: Raymond Toy <[email-masked]>
Date: Tue Feb 17 13:16:04 2004

>>>>> "Sam" == Sam Steingold <[email-masked]> writes:

    Sam> The general idea is that the _only_ reason to use -ansi or set *ANSI*
    Sam> is to run an ANSI compliance suite.

Really?  Why bother then having -ansi and *ansi*, since you're
purposely not being compliant!

I always set -ansi be cause that is my expectation.

(Bugs in the implementation are a different matter...)

Ray

-- 
--

---

From: Scott Williams <[email-masked]>
Date: Tue Feb 17 16:43:03 2004

I opt for #2

---

From: "Paul F. Dietz" <[email-masked]>
Date: Tue Feb 17 18:30:02 2004

> Where "true" basically means not NIL.

There are two constraints here.  Return T satisfies them both.
Returning the truename satisfies only the second one.

	Paul

---

From: zera holladay <[email-masked]>
Date: Tue Feb 17 20:52:02 2004

Here’s my argument let me know if I am incorrect. 
Assume delete-file() either returns T or signals an
error if it does not.  If delete-file() does not
return T, then it returns (not T) and delete-file()
must signal an error.  If (T=true) and (true=not NIL)
and (NIL=false), then (T=not false) and (not T=not
true=false=NIL).  Implicit in the specification is
that delete-file() returns NIL on failure and (not
NIL) on success, otherwise it would be pointless to
test for truth at all.  Does that make sense?

-zh

__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

---

From: "Paul F. Dietz" <[email-masked]>
Date: Wed Feb 18 02:15:01 2004

> test for truth at all.  Does that make sense?

No, it doesn't make sense.  The spec says delete-file
throws an error if it cannot delete the file.  Nowhere
does it say it returns NIL for anything.

	Paul

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Wed Feb 18 04:42:01 2004

> > >     Sam> In ANSI CL, DELETE-FILE is specified to return T on
> > >          success. CLISP returns the truename of the deleted file.
> > 
> > There are two constraints here.  Return T satisfies
> > them both. Returning the truename satisfies only the second
> > one.

Perhaps changing  the result  to T  would be a  good think  since that
would force non conformant programs to become more conformant...

---

From: Sam Steingold <[email-masked]>
Date: Wed Feb 18 12:49:07 2004

> * Sam Steingold <[email-masked]> [2004-02-17 13:00:50 -0500]:
>

implemented.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Apathy Club meeting this Friday.  If you want to come, you're not invited.

---

From: Sam Steingold <[email-masked]>
Date: Wed Feb 18 12:56:04 2004

> * Raymond Toy <[email-masked]> [2004-02-17 16:09:56 -0500]:
>
>     Sam> The general idea is that the _only_ reason to use -ansi or
>     Sam> set *ANSI* is to run an ANSI compliance suite.
>

note that I also said that "One should set the 6 options
(http://clisp.cons.org/impnotes/ansi.html) one by one, as desired."

please do not read into my words more than I put there.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Do not tell me what to do and I will not tell you where to go.

---

From: Raymond Toy <[email-masked]>
Date: Wed Feb 18 13:40:09 2004

>> purposely not being compliant!

    Sam> note that I also said that "One should set the 6 options
    Sam> (http://clisp.cons.org/impnotes/ansi.html) one by one, as desired."

    Sam> please do not read into my words more than I put there.

I don't think I read too much.  You said -ansi is only for running an
ANSI compliance test.  I would think -ansi is for making clisp purport
to conform to the ANSI spec.  I also fail to see why I would want ansi
behavior for this thing but not that thing, except to maintain some
backward compatibility with old clisp code.

I hope that would eventually be the default, but it's your perogative
not to do so.

I certainly want to run clisp with -ansi.

Ray

-- 
--

---

From: Sam Steingold <[email-masked]>
Date: Wed Feb 18 14:23:02 2004

> * Raymond Toy <[email-masked]> [2004-02-18 16:33:45 -0500]:
>
> to conform to the ANSI spec.

same thing.

Please do not underestimate our commitment to ANSI though.

> I also fail to see why I would want ansi behavior for this thing but
> not that thing,

Because some ANSI requirements, e.g., that negative :COUNT is treated
as 0, are detrimental to debugging, others prevent you from printing
some pathnames readably, &c.

ANSI CL spec is a wonderful standard, but it does have some glitches,
and it is unlikely that you would want _ALL_ these places interpreted
exactly like the majority.
You see, if 80% of the people agree on each questionable issue (which is
a very strong majority!) then (assuming independence!) the probability
that one would agree with the majority on 3 issues is just above 50%
and for 5 issues it is less than 33%.
This is why it is generally a good idea to think before using "-ansi".
(I am pretty sure that most of CLISP users what *PARSE-NAMESTRING-ANSI*
and *MERGE-PATHNAMES-ANSI* set to T and the other 4 variables set to
NIL, but this is a really boring subject).

On the other hand, _thinking_ about something requires an effort which
is often better spent elsewhere.

This, by the way, reminds me of the POSIXLY_CORRECT environment
variable which is respected by some GNU utilities.

> I hope that would eventually be the default, but it's your perogative

Talk to Bruno about it.
He has a strong opinion about this.
I don't really care.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
He who laughs last did not get the joke.

---

From: Raymond Toy <[email-masked]>
Date: Wed Feb 18 15:28:03 2004

>> to conform to the ANSI spec.

    Sam> same thing.

    Sam> Please do not underestimate our commitment to ANSI though.

Ok.  Perhaps I inferred the wrong thing, but it sure seemed like you
thought ansi was only good for running the compliance test and nothing
else. :-)

    Sam> On the other hand, _thinking_ about something requires an effort which
    Sam> is often better spent elsewhere.

No problem with that.  I, for one, have no desire or interest to
figure out how to add NIL arrays or specialized arrays of
unsigned-byte 7 to CMUCL.  I think there are better things to do. 

    >> I hope that would eventually be the default, but it's your perogative

    Sam> Talk to Bruno about it.
    Sam> He has a strong opinion about this.
    Sam> I don't really care.

The default isn't a big deal, as long as -ansi exists.

Ray

-- 
--

---

From: Sam Steingold <[email-masked]>
Date: Thu Feb 19 12:22:05 2004

> thought ansi was only good for running the compliance test and nothing

please be careful.
"clisp -ansi" differs from "clisp -traditional" very very little.
really.
it is extremely unlikely that you will notice any difference in
day-to-day use, and the traditional mode might even help you catch a
random error in your code.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
The software said it requires Windows 3.1 or better, so I installed Linux.

---

From: Bruno Haible <[email-masked]>
Date: Sun Feb 22 05:46:03 2004

> CLISP returns the truename of the deleted file.

Looking at CLHS (I don't have a copy of ANSI CL):
Where do you read that returning the truename is not allowed?

- The overview of the function is

     "delete-file filespec => t"

  where "t" refers to the page leaving the choice between the symbol T
  and the class T. The latter allows any return value.

- The description of the function says

     "delete-file returns true if it succeeds"

  and "true" means any non-NIL object.

- The examples of the function are not relevant, according to CLHS
  section 1.4.3.

Bruno

---

From: "Paul F. Dietz" <[email-masked]>
Date: Sun Feb 22 05:53:04 2004

>   and the class T. The latter allows any return value.

No, the 't' there refers to a value being returned, not its type.
There are plenty of places where the return value is => nil, and the
type NIL has no elements.

See section 1.4.4.20.4:  "An evaluation arrow ``=> '' precedes a list
of values to be returned."

The types of entities specified in the Syntax section are defined
in the 'Arguments and Values' section of a dictionary entry.

	Paul

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Sun Feb 22 07:18:00 2004

> in the 'Arguments and Values' section of a dictionary entry.

Let's hope the  next version of the standard will  be more formal, and
at least includes signatures for all functions:

(declaim (ftype (function (pathname) (member t)) delete-file))

vs.

(declaim (ftype (function (pathname) t) delete-file))

---

From: Sam Steingold <[email-masked]>
Date: Sun Feb 22 07:56:01 2004

> * Bruno Haible <[email-masked]> [2004-02-22 14:34:03 +0100]:
>
> Sam Steingold wrote:

Actually, everywhere else this overview entry has the _type_ of the
value, not the value (or its description).
So, you appears to be correct!

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
The only substitute for good manners is fast reflexes.

---

From: Carlo Traverso <[email-masked]>
Date: Sun Feb 22 09:34:07 2004

>>  Looking at CLHS (I don't have a copy of ANSI CL): Where do you
    >> read that returning the truename is not allowed?
    >> 
    >> where "t" refers to the page leaving the choice between the
    >> symbol T and the class T. The latter allows any return value.

    Sam> Actually, everywhere else this overview entry has the _type_
    Sam> of the value, not the value (or its description).  So, you
    Sam> appears to be correct!

If the interpretation t = symbol were true, delete-file cannot return NIL.

Carlo