Re: apply on dotted argument lists

Sam Steingold <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
Hi Bruno,

> * Bruno Haible <[email protected]> [2012-04-13 02:42:16 +0200]:
>
> Moving the discussion from the bug tracker
> https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3517196&group_id=1355
> to the list.

bad idea.
before: both clisp-devel and sf bug tracker knew the reasoning.
now: only clisp-devel does.

>> 1. I don't think you can separate compiled from interpreted here:
>> both are done by apply_closure
>
> The compiled closure is handled in the first part of apply_closure,
> the interpreted one in the last 20 lines of apply_closure. This
> one-liner should produce an error in the interpreted case:

sure.

>> 2. I don't think adding an explicit list check to the evaluator makes
>> much sense.
>
> Why? I think it does: Any useful error message that occurs while a
> user is testing his program in interpreted mode is useful.

what I meant was something like

  object dotted;
  list_length(args,&dotted);
  if (!nullp(dotted))
    goto error_dotted;

>> 3. Bruno, why do you have error_apply_dotted signal a program-error and
>> error_apply_toofew signal an argument-list-dotted error? these look weird:
>> 
>> > (apply #'cons 1)
>> *** - APPLY: dotted argument list given to CONS : 1
>> > (apply #'read-from-string "a" 2)
>> *** - APPLY: argument list given to READ-FROM-STRING is dotted (terminated
>> by 2)
>> 
>> I think the messages (and errors) should be identical.
>
> I agree that the messages are unnecessarily different.
>
> About the error types: Since PROGRAM-ERROR is defined as errors relating
> to "program syntax"
> <http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_program-error.html>
> but here we don't have a wrong program (that could be caught at
> compile-time), just wrong data (at runtime), I think that PROGRAM-ERROR
> is wrong here, in both cases.

I am not so sure.  (apply #'foo 1) can be caught at compile time and is
probably second only to (format "..." ...) in frequency.

> But in the first case, CLHS section 3.5.1.2
> <http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-5-1-2.html>
> forces us to signal a PROGRAM-ERROR (or subtype thereof), even though
> it's nonsense.
>
> In the second case, CLHS does not specify which error is signaled
> (see <http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html#apply>:
> "Exceptional Situations: None."). Why should we repeat the same nonsense here?

I think Occam requires the same behavior in both cases.
Moreover, your argument-list-dotted is already a subtype of
program-error, so I really see no reason for this dichotomy.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.childpsy.net/ http://americancensorship.org http://www.memritv.org
http://memri.org http://jihadwatch.org http://truepeace.org
You think Oedipus had a problem -- Adam was Eve's mother.

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.