Re: alternative to execute available? [message #72878] |
Wed, 13 October 2010 08:05 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chris writes:
>> for i=0l,n_tags(ex)-1l do (scope_varfetch((tag_names(ex))[i], /enter))=ex.(i)
>>
>> regards,
>> lajos
>
> Very cool! THANK YOU!
Now you're programming like an iTools developer! ;-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: alternative to execute available? [message #72880 is a reply to message #72878] |
Wed, 13 October 2010 08:00  |
rogass
Messages: 200 Registered: April 2008
|
Senior Member |
|
|
On 13 Okt., 16:22, FÖLDY Lajos <fo...@rmki.kfki.hu> wrote:
> On Wed, 13 Oct 2010, chris wrote:
>> Hi there,
>> I'm often using the _extra keyword in my routines together with a
>> simple approach to give variables values, like this one
>
>> pro test_ex, _extra=ex
>> for i=0l,n_tags(ex)-1l do _=execute((tag_names(ex))[i]+'=ex.(i)')
>> end
>
>> If I would call this like: test,/hello,d=dist(10)
>> it would give me within the pro: d with the value dist(10) and hello
>> with the value 1
>
>> It works fine, but has one big limitation. I cannot use this technique
>> if I would like to produce working binaries (sav-files). Is there any
>> way to avoid the execute call without having information which
>> keywords were passed to the test_ex routine?
>
>> Thanks and regards
>
>> CR
>
> for i=0l,n_tags(ex)-1l do (scope_varfetch((tag_names(ex))[i], /enter))=ex.(i)
>
> regards,
> lajos
Very cool! THANK YOU!
Cheers
CR
|
|
|
Re: alternative to execute available? [message #72883 is a reply to message #72880] |
Wed, 13 October 2010 07:22  |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Wed, 13 Oct 2010, chris wrote:
> Hi there,
> I'm often using the _extra keyword in my routines together with a
> simple approach to give variables values, like this one
>
> pro test_ex, _extra=ex
> for i=0l,n_tags(ex)-1l do _=execute((tag_names(ex))[i]+'=ex.(i)')
> end
>
> If I would call this like: test,/hello,d=dist(10)
> it would give me within the pro: d with the value dist(10) and hello
> with the value 1
>
> It works fine, but has one big limitation. I cannot use this technique
> if I would like to produce working binaries (sav-files). Is there any
> way to avoid the execute call without having information which
> keywords were passed to the test_ex routine?
>
> Thanks and regards
>
> CR
for i=0l,n_tags(ex)-1l do (scope_varfetch((tag_names(ex))[i], /enter))=ex.(i)
regards,
lajos
|
|
|