Feature Suggestion: Variable Scope in Exports

Sometimes the scope of user variables in Exports is a little awkward to use, because it is not possible to use a variable that has been set previously within an outer loop. For some reason, the scope of the user variables extends outwards, not inwards.

This will not function (and it’d be nice if it did!):

$loop(%genre%)
$puts(fn,%genre%.m3u)
$loop(%_path%)
ECHO %_path% >> $get(fn)
$loopend()
$loopend()

(Over-simplified code snippet, extra line feeds added for readability.)

The variable fn will be undefined within the inner $loop(…).

Is it possible to change that?

Well, Moonbase, you are right to ask again for some better design and usability of user defined variables regarding their visibility in loops. I've mentioned it here and there in my postings over the years, too.
However your example is not quite good to demonstrate the point.
Your example is simplified like this:
$loop(%genre%)
'ECHO.Genre: '%genre%
$loop(%_path%)
'ECHO.'%_path%' >> '%genre%'.m3u'
$loopend()
$loopend()

DD.20081121.1425.CET

Nevertelesse, this export script demonstrates how confusing it can be.
$loop(%genre%,1)
'G0:'$put(fn,%genre%'.m3u')
$loopend()
$loop(%genre%)
'G1:'$get(fn)
'G2:'$put(fn,%genre%'.m3u')
'ECHO.Genre: '%genre%
$loop(%_path%)
'ECHO.'%_path%' >> '$get(fn)
$loopend()
$loopend()

DD.20081121.1447.CET

What also comes to mind is of course the apparent inefficiency in handling loop conditions. On a quite simple one, like
$loop($if(%origyear%,$div($left(%origyear%,4),10)0,$if(%year%,$div($left(%year%,4),10)0,'[unknown]')),1)which I use to provide playlists by decades, Mp3tag computes 2 hours 40 minutes for a smaller collection of only 22,845 MP3s (on a 1.8 GHz XP machine; no other applications running) while eating up between 98 and 99% CPU cycles… Which makes it not really the perfect choice for performing some everyday chores (though I’d like that, of course).