--- In [email protected], "entropyreduction" 
<alancampbelllists+ya...@...> wrote:
>
> --- In [email protected], "forxtra" <forxtra@> wrote:
> 
> > it would also work fine for me without generating orphaned handles:
> > ; ----------------------
> > unicode.file_watchfolder(unicode.new(?#C:\#), "Win.Debug(,)")
> > ; ----------------------
>  
> That will have same effect as 
> 
> local uFolder = unicode.new(?#C:\#)
> unicode.file_watchfolder(uFolder, "Win.Debug(,)")
> 
> You're an implicit local, which will be released (immediately after 
> expression its in is evaluated.  So when watchfolder comes back with a 
> result, the handle passed to it as folder name will be old news and invalid.
>

I expected as you said.


Result:

1. explicit local
local uFolder = unicode.new(?#C:\#)
unicode.file_watchfolder(uFolder, "Win.Debug(,)")
//=> u_3001 u_3001
- folder info is overwritten with a file.


2. implicit local within expression
unicode.file_watchfolder(unicode.new(?#C:\#), "Win.Debug(,)")
//=> u_3001 u_3002


3. static
static uFolder = unicode.new(?#C:\#)
unicode.file_watchfolder(uFolder, "Win.Debug(,)")
//=> u_3001 u_3002


In case of #2, it seems not to increase handle counts.
So when evaluating Arg(2), handle might be assigned sequentially.




Reply via email to