From: Rony G. F. <Ron...@wu...> - 2007-02-13 21:01:41
|
Hi Rick et.al., > In general, I think this entire thing is a good idea, particularly the > use for IN/OUT and OUT arguments. The old way of doing stuff was > basically broken with IN/OUTs and horribly difficult to use with > others. I do have some questions about the actual implementation. Yes, Mark did an outstanding job on creating this whole support, IMHO! > See my comments below. > That code, using OLEVariant as I now see it would be: > > objProcess = .oleObject~GetObject("WinMgmts:Win32_Process") > > pid = .OLEVariant~new( VT_I4, 0, "IN,OUT" ) > ret = objProcess~Create('notepad.exe', .nil, .nil, pid) > > If ret == 0 then do > say 'The created process ID is:' pid > 'taskkill /PID' pid > end > > > I'm not entirely certain how the above works. The pid variable is > still pointing to the OLEVariant instance, not the value returned in > the variant instance. Normally, you'd expect to extract the value > from the variant object before using it. It is possible to add an > UNKNOWN method to OLEVariant and override STRING to pass the messages > on to the value object, but this can be a bit of a usability trap for > situations where the proxying breaks down. In particular, overriding > STRING (which would be necessary to get the SAY operation above to > work) removes a useful debugging aid by masking the existence of the > proxy object. The UNKNOWN mechanism put in place allows the OLEVariant objects to be used "transparently" like it is possible for VBScript/VBasic. Using the string-rendering of the "varValue" as the ooRexx "required string value" (by supplying the method MAKESTRING) would match the VBScript/VBasic usage and will be probably what such coders (or people studying and transcribing VBS/VB code to ooRexx) would expect. Of course, the usage as a debugging aid (indicating that an OLEVariant object is used) would be forgone with this behaviour. But looking at ooRexx itself, we have classes that do exactly the same, e.g. the Stream class (returning the file's filename the stream object stands for) or the Array class (returning a newlined list of the elements) or the CircularQueue class (where the delimiter to be used can be even supplied). So I would say, as long as this gets clearly documented, it should not be a problem. Probably it helps transcribing VBS/VB code to ooRexx considerably. Regards, ---rony |