Trouble with compile



Dnia Sun, 25 Jul 2010 23:51:59 +0200, mok-kong shen napisa?(a):

> Adam Majewski wrote:
>> mok-kong shen wrote:
>>
>>> Being beginner, I can't understand why
>>>
>>>     array (u,integer,5);
>>>     hh():=block(u[2]:333, print(u[2])); hh();
>>>
>>> works but on the other hand
>>>
>>>     array (u,integer,5);
>>>     hh():=block(u[2]:333, print(u[2])); compile(hh); hh();
>>>
>>> leads to an error message.
> 
>> Maybe try single quote operator :
>>
>> array (u,integer,5);
>>     hh():=block(u[2]:333, print(u[2])); compile('hh); hh();
>>
>> (I think that it comes from Lisp )
> 
> Indeed that works. In another larger program of mine that runs without
> the quote in the compile command, there were a number of warnings on
> compilations, e.g. "Warning-> x is an undefined global variable". 

It looks like Lisp warning : one should declare variable before first use

(defvar s)
(setq s 600)

not only :

(setq s 600)



> With your tip I again compiled it, this time with the quote in the 
compile
> command and found that no such warnings came out. So the quote seems to
> cause some differences in general. Should one always use the quote?

Good question. I can't answer. Maybe some experts will do ?

Adam