Code: Select all
OpenExcelFile←{
⍝ ⍵ ←→ File Name
⍝ ← ←→ .NET ZipArchive
⎕USING←'System.IO.Compression,System.IO.Compression.FileSystem.dll'
ZipFile.OpenRead⊂⍵
}
It works. But only if there is not some object (a variable, function, or namespace) named ZipFile as a sibling of OpenExcelFile. (Leaving aside what ⎕PATH might do!).
I can covert to a trad function, and localize ZipFile in the header, and then it will work properly in all cases. (The trad function in more functional than the dfn!)
Two questions:
1. Is there any way to properly do this in a dfn? That is, is there a more explicit way to say I want to use a .NET class?
2. In trad function, it would seem a requirement to localize any top-level .NET name one accesses as otherwise the function only really works by accident as is the case with the dfn. Or am I missing something?