Author Topic: Quit vs Exit in AutoLisp  (Read 12156 times)

0 Members and 1 Guest are viewing this topic.

mailmaverick

  • Bull Frog
  • Posts: 493
Quit vs Exit in AutoLisp
« on: December 30, 2014, 07:44:59 AM »
Whats the difference between Quit and Exit in AutoLisp ?


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Quit vs Exit in AutoLisp
« Reply #1 on: December 30, 2014, 07:53:28 AM »

Essentially none.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Quit vs Exit in AutoLisp
« Reply #2 on: December 30, 2014, 08:18:43 AM »
TIC - One is poor technique and the other is lazy programing.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Quit vs Exit in AutoLisp
« Reply #3 on: December 30, 2014, 08:37:19 AM »
TIC - One is poor technique and the other is lazy programing.

Please explain.


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Quit vs Exit in AutoLisp
« Reply #4 on: December 30, 2014, 10:07:20 AM »
These are relevant to your question:

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/quit-vs-exit/td-p/836439
http://www.afralisp.net/autolisp/tutorials/cond-vs-if.php

PS
The TIC is Tongue In Cheek and a dated expression meaning an attempt at humor.
Although a poor one I must admit. 
« Last Edit: December 30, 2014, 10:11:02 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Quit vs Exit in AutoLisp
« Reply #5 on: December 30, 2014, 10:44:04 AM »
I'd never seen that COND vs IF article on afralisp before; nice link CAB.

I agree with the use of COND over IF; I've had a few arguments over the use of IF vs COND and keeping the namespace hygienic. ...Not to mention the use of a BOOLE in place of a simple COND or IF statement (that drives me batty when the tactic is misused).

If I remember right, I would use QUIT in dialog box situations and not so much in regular application situations (you need to properly set up your error handler environment to handle their use). I assembled "a better error handler", from a few people's efforts. (just search the "show your stuff" forum for my name and error) that should get you started if you wanted to.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Quit vs Exit in AutoLisp
« Reply #6 on: December 30, 2014, 11:47:24 AM »
These are relevant to your question:

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/quit-vs-exit/td-p/836439
http://www.afralisp.net/autolisp/tutorials/cond-vs-if.php

PS
The TIC is Tongue In Cheek and a dated expression meaning an attempt at humor.
Although a poor one I must admit. 


As per the links shared by you, there is no difference between quit and exit.

However, if AUTOLISP has made these two commands, there has to be a difference.

There cannot be two commands for exactly same thing.

It would be good to know the difference for academic purposes. :-D


JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Quit vs Exit in AutoLisp
« Reply #7 on: December 30, 2014, 11:51:17 AM »
Why does there have to be a difference?

http://theswamp.org/~john/avlisp/#exit
http://theswamp.org/~john/avlisp/#quit

Set up an error handler and test them each.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Bhull1985

  • Guest
Re: Quit vs Exit in AutoLisp
« Reply #8 on: December 30, 2014, 12:13:08 PM »
These are relevant to your question:

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/quit-vs-exit/td-p/836439
http://www.afralisp.net/autolisp/tutorials/cond-vs-if.php

PS
The TIC is Tongue In Cheek and a dated expression meaning an attempt at humor.
Although a poor one I must admit. 


As per the links shared by you, there is no difference between quit and exit.

However, if AUTOLISP has made these two commands, there has to be a difference.

There cannot be two commands for exactly same thing.

It would be good to know the difference for academic purposes. :-D

Could it just be that Autodesk assumed when exiting (or quitting) an app that the majority of persons would be accustomed to using one of these two commands?
And rather than to have the "quit"ters receive an 'Unknown command "QUIT". Press F1 for help.'
or
the "exit"ers have the opposite...they just decided to implement both commands for fluidity?
That's what I would guess, especially reading that there are no documented differences at least shown in this thread.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Quit vs Exit in AutoLisp
« Reply #9 on: December 30, 2014, 12:41:30 PM »
TIC - One is poor technique and the other is lazy programing.

I completely agree - there are very few cases in which such functions cannot be avoided, in my mind they are the equivalent of resorting to a goto statement to control code evaluation...

Perhaps one of the few situations in which the use of such functions is unavoidable is within a vl-catch-all-apply expression to essentially break evaluation of a vlax-for expression when a certain condition is met in order to avoid unnecessary iteration of an entire collection - but this is also a rare case.

As for the difference between the two, as far as I am aware, there is none. This may seem redundant, but then remember that AutoLISP is a high-level language and consequently there are many functions which are present merely for convenience - after all, any cond expression can be written using a sequence of nested if expressions, any loop could be written using while, 1+/1- are entirely superfluous, etc. etc.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Quit vs Exit in AutoLisp
« Reply #10 on: December 30, 2014, 03:22:39 PM »
Quote from: mailmaverick
As per the links shared by you, there is no difference between quit and exit.

The links said it.
I said it.
John's excellent avlisp help file for theSwamp saya it
The AutoLisp Help files said it.


Quote from: mailmaverick

However, if AUTOLISP has made these two commands, there has to be a difference.

Why does there have to be a difference ?


Quote from: mailmaverick

There cannot be two commands for exactly same thing.

Why ?

Quote from: mailmaverick

It would be good to know the difference for academic purposes. :-D

Academic pursuits are excellent but you need to check your premises. There is no difference and no amount of assumptions and second guessing will change that.



kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Quit vs Exit in AutoLisp
« Reply #11 on: December 30, 2014, 03:35:58 PM »
I haven't been around AutoLisp / lisp long enough but could it be a legacy issue.
New function name created & old name not removed.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Quit vs Exit in AutoLisp
« Reply #12 on: December 30, 2014, 03:36:50 PM »
They are spelled different.

From the Lisp Console
Code: [Select]
_$ exit
#<SUBR @0000000031fde8b8 QUIT>
_$ quit
#<SUBR @0000000031fde8b8 QUIT>
_$
So looks like they both evaluate to calling the same subroutine.

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Quit vs Exit in AutoLisp
« Reply #13 on: December 30, 2014, 07:46:35 PM »
TIC - One is poor technique and the other is lazy programing.

I completely agree - there are very few cases in which such functions cannot be avoided, in my mind they are the equivalent of resorting to a goto statement to control code evaluation...

...

I apologize I am typing this via my phone so I'm keeping this brief.
goto is all together different. Comparing apples to oranges.

I wouldn't say that the functions usage is all that bad either (the goto is a negative connotation); after all they did make vl-exit-with-message.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org