Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

quit vs. exit

45 views
Skip to first unread message

Kevin Hayward

unread,
Jan 28, 2003, 3:42:45 PM1/28/03
to
Hi,

just to answer my own curiosity, is there any difference between the
AutoLisp functions (quit) and (exit)?

When and how do you folks use them?

Thanks

--
Kevin Hayward

WLB Group


Jason Piercey

unread,
Jan 28, 2003, 4:04:57 PM1/28/03
to
Don't know what the difference is, but as far as use..... IMO, if you find
yourself using these functions to terminate an application due to an error
of some sort you need to rethink the flow of the code. I don't *ever* user
them, this is one example where it does make sense.

; Tony Tanzillo
; name is NOT case-senseitive
; must include .dwg
; Return: Document object if open, or NIL
(defun isDocOpen(name / temp)
(setq name (strcase name))
(vl-catch-all-apply
'(lambda ()
(vlax-for doc (vla-get-documents (vlax-get-acad-object))
(if (eq name (strcase (vla-get-name doc)))
(progn (setq temp doc) (exit))
)
)
)
)
temp
)

--

-Jason
Member of the Autodesk Discussion Forum Moderator Program


"Kevin Hayward" <khay...@wlbgroup.com> wrote in message
news:946CBE9F0FD32AC6...@in.WebX.maYIadrTaRb...

Jim Claypool

unread,
Jan 28, 2003, 4:33:40 PM1/28/03
to
I guess I should consider myself reprimanded.
I use exit quite often, along with an *error* function, to stop a routine
just to avoid long and embedded if statements.

For instance, if a dialog box is not available or cancel is picked in a
dialog,
rather that have a long if statement to "do stuff" if everything is ok, I
will
use exit to abruptly stop with an appropriate message, usually in an alert
box.

It is all a matter of opinion, I suppose.

"Jason Piercey" <Jason@AtrEngDotCom> wrote in message
news:B51FC98AAEEDBA9A...@in.WebX.maYIadrTaRb...

Jason Piercey

unread,
Jan 28, 2003, 4:38:50 PM1/28/03
to
S'pose it is. I have done very little with dialogs. Maybe I am in the
minority here with exit/quit ?

--

-Jason
Member of the Autodesk Discussion Forum Moderator Program

David Bethel

unread,
Jan 29, 2003, 9:00:38 AM1/29/03
to

quit & exit have the exact same effect. There maybe small difference
within the machine code but none that will show up in the running of the
code.

I have no problem their use as long as there is a robust error trap and
it includes reseting the system back to its original state.

-David

Tom Smith

unread,
Jan 29, 2003, 8:40:20 AM1/29/03
to
An old rule of thumb in lisp...any time you're using if, cond is probably
better. If it's a big complicated if, cond is definitely WAY better. You can
usually set it up so the terminating condition is clear (i.e. everything is
okay) and all other cases are handled appropriately (i.e. by doing nothing).

Jim Claypool <jcla...@kc.rr.com> wrote in message
news:DDDDBC4C06160F8F...@in.WebX.maYIadrTaRb...

David Bethel

unread,
Jan 29, 2003, 9:04:45 AM1/29/03
to

Hmmmm.....

R12 - quit & exit have unique subr numbers

A2K - they are exactly the same. ( quit )

-David

Tom Smith

unread,
Jan 29, 2003, 4:43:25 PM1/29/03
to
Jason, I tend to agree, it's a red flag that the code isn't structured in
the best way. The quit/exit amounts to a goto, and if it happens more than
once in a program you're on the road to spaghetti-code hell. That's exactly
the kind of thing that lisp in particular (and functional languages in
general) were designed to avoid.

Just as deeply nested ifs are a red flag...in fact any nesting of ifs at all
raises the question, why not cond instead? It will nearly always be clearer,
simpler, and easier to debug and maintain. A red flag doesn't mean *never*
do it no matter what, it just means it should alert your instincts that
there's *got* to be a better way.

A lot of autolispers seem to be real smart about the innards of Acad without
really comprehending lisp itself...more often than not, lisp functions tend
to written in an unreadable, basic-like procedural manner that denies the
elegance and simplicity that's possible in the language.

More autolispers should search out and read some of the many available
articles on programming style written by the gurus of Common Lisp. Nearly
all of this applies directly to AutoLISP. The "real" lisp people are
remarkably consistent about what is proper and good.

Jason Piercey <Jason@AtrEngDotCom> wrote in message
news:B51FC98AAEEDBA9A...@in.WebX.maYIadrTaRb...

0 new messages