Author Topic: Warning message from vlide  (Read 1515 times)

0 Members and 1 Guest are viewing this topic.

MeasureUp

  • Bull Frog
  • Posts: 465
Warning message from vlide
« on: May 23, 2013, 12:52:16 AM »
I notice that there is a warning message popping up when clicking the button of "check edit window" for code with local function(s) in VLIDE window. Here is a sample:
Code: [Select]
(defun c:Test (/ ABC)
(defun ABC ()
(prompt "ABC.")
)
(if (eq (getstring "\nSecret Code: ") "Test")
(ABC)
)

(princ)
); end of Test

It returns the following:
Quote
[CHECKING TEXT Test.lsp loading...]
.
; warning: local variable used as function: ABC
; Check done.


What is wrong? and how to fix the code?
Thanks for your help.
« Last Edit: May 23, 2013, 01:27:38 AM by MeasureUp »

Gasty

  • Newt
  • Posts: 90
Re: Waring message from vlide
« Reply #1 on: May 23, 2013, 01:32:03 AM »
Hi,

It's only a friendly warning, nothing wrong with that (it will work), but, why do you use a local defun(ed) function in this situation?, do you really need it in that way? In most cases a Lambda will work perfectly, in this case you don't  even need a Lambda or inline function, just a  call to prompt and that's it. There are cases in which you may need to encapsulate a function in order to avoid collisions with some other pieces of code, or just for clarity, but this is not the case.

Gaston Nunez




 

MeasureUp

  • Bull Frog
  • Posts: 465
Re: Warning message from vlide
« Reply #2 on: May 24, 2013, 01:40:15 AM »
Thanks.
I am reviewing my codes and would like to localise the local functions.
"lambda" may not be the case.
« Last Edit: May 24, 2013, 02:19:17 AM by MeasureUp »