reg inclusion of "loadi" command in code

N

noreply

Guest
Dear all ,
I want to call a procedure in my code. The procedure is around 300
lines.
Hence i wrote the following line inside my file:
loadi "~/mycode.il";where "mycode.il" is the file that contains the
procedure
.........
......
Is this a correct way of loading a procedure or is there some
efficient way of doing it.

Thanks and regards,
Lokesh rajendran
 
Hi Lokesh,

A 300-lines code is nothing. Leaving that procedure in your main file
wont be harmful. Having said that, if your procedure is a kind of
generic procedure that might be used elswhere then it's a good idea to
put aside.
Also, please bear in mind the difference between the Skill functions
'load' and 'loadi'. 'loadi' is Identical to 'load', except that loadi
ignores errors encountered during the load, prints an error message,
and then continues loading.

Cheers,
Riad.
 
Riad KACED wrote, on 07/08/09 08:21:
Hi Lokesh,

A 300-lines code is nothing. Leaving that procedure in your main file
wont be harmful. Having said that, if your procedure is a kind of
generic procedure that might be used elswhere then it's a good idea to
put aside.
Also, please bear in mind the difference between the Skill functions
'load' and 'loadi'. 'loadi' is Identical to 'load', except that loadi
ignores errors encountered during the load, prints an error message,
and then continues loading.

Cheers,
Riad.
Personally I think that loadi should rarely be used - because you can end up
masking real errors which are important. Better to fix the errors than load them
ignoring errors...

Also, are you talking about procedures (as defined with procedure(), or defun()
or similar)? Or are you just putting all your code in flat "scripts"?

The best solution is to define procedures (or functions - they're the same thing
in SKILL), and then these get byte-code compiled and you can then call them by
name rather than having to continually load files to execute things.

Read the SKILL Language User Guide - it's a very good place to start, as it
covers the structure of the language, as well as efficient ways to do things.

Regards,

Andrew.
 
Hi andrew ,
I at last ended up doing as you have suggested.(And also i will keep
in my mind not to use "loadi" in my code here afterwards)
Regards,
Lokesh rajendran

On Jul 8, 5:13 pm, Andrew Beckett <andr...@DcEaLdEeTnEcTe.HcIoSm>
wrote:
Riad KACED wrote, on 07/08/09 08:21:

Hi Lokesh,

A 300-lines code is nothing. Leaving that procedure in your main file
wont be harmful. Having said that, if your procedure is a kind of
generic procedure that might be used elswhere then it's a good idea to
put aside.
Also, please bear in mind the difference between the Skill functions
'load' and 'loadi'. 'loadi' is Identical to 'load', except that loadi
ignores errors encountered during the load, prints an error message,
and then continues loading.

Cheers,
Riad.

Personally I think that loadi should rarely be used - because you can end up
masking real errors which are important. Better to fix the errors than load them
ignoring errors...

Also, are you talking about procedures (as defined with procedure(), or defun()
or similar)? Or are you just putting all your code in flat "scripts"?

The best solution is to define procedures (or functions - they're the same thing
in SKILL), and then these get byte-code compiled and you can then call them by
name rather than having to continually load files to execute things.

Read the SKILL Language User Guide - it's a very good place to start, as it
covers the structure of the language, as well as efficient ways to do things.

Regards,

Andrew.
 

Welcome to EDABoard.com

Sponsor

Back
Top