help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: condition-case


From: Ted Zlatanov
Subject: Re: condition-case
Date: Fri, 10 Dec 2010 12:40:06 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

On Thu, 09 Dec 2010 10:04:12 -0500 Stefan Monnier <monnier@iro.umontreal.ca> 
wrote: 

>> Here's what Pascal posted originally.
SM> The code looks fine (tho it needs a reindent to follow Elisp
SM> convention).  The docstring needs a completely rewrite, OTOH, to follow
SM> Elisp convention: first line should succintly describe the macro, and
SM> the rest should give details about what it does and what each
SM> param means.  I.e. someone not familiar with Common-Lisp should be able
SM> to understand how to use it.

Yes, that's not hard.  I was worried about the code's behavior.

>> (subst  var (car clausvar) body)))))

SM> Oh wait, I just noticed this one: `subst' is wrong here.  I know CL
SM> already uses it for similar purposes elsewhere, but it's simply wrong
SM> because `subst' doesn't know about Elisp binding rules.
SM> So (subst 'b 'a '(lambda () '(a b c))) will happily return
SM> (lambda () '(b b c)).  Better simply use `let', even if it has
SM> a performance cost.

I didn't catch that.  I don't know enough about ELisp vs. CL scoping and
binding rules to write this properly, unfortunately.  Can you show how
`let' could be used?  I'll take the code and provide the doc string and
reindent it, then propose the revised version in emacs-devel.

On Thu, 09 Dec 2010 05:34:02 +0100 "Pascal J. Bourguignon" 
<pjb@informatimago.com> wrote: 

PJB> Ted Zlatanov <tzz@lifelogs.com> writes:

>> Here's what Pascal posted originally.  I tested it a little and it seems
>> to work OK; it's basically syntactic sugar but pretty pleasant.  We
>> should also consider `handler-bind' which is like `handler-case' but
>> executes handlers directly.  Pascal, do you have an implementation of
>> that as well?

PJB> There's no condition-bind to wrap over.

PJB> I'm not sure it would be possible to implement handler-bind without
PJB> patching the virtual machine.

Stefan, WDYT?  Is `condition-bind' possible in today's GNU Emacs?  I
mean does the VM have any constraints that would block it?

Ted


reply via email to

[Prev in Thread] Current Thread [Next in Thread]