Analysing the project returns this:
Unused local variables: w is an unused local variable
On one hand, it makes sense, as I don’t do anything with “w”.
But, on the other hand, this line alone makes a new window (and, without implicit instance, there’s no other way than using a variable for that).
So, “w” is both needed and unused at the same time, which I find paradoxical.
Prior making a feedback case, I’d like other opinions whether I should…
I can understand why you’d view this as a bug, but I imagine it would require the analysis to resolve the type to some sort of exception for the window class. I don’t know if they have a system currently in place for that, but it’s correct either way you look at it and I doubt it would be addressed to anyone’s satisfaction.
Wouldn’t Call discard a returned reference from the Constructor in such way that the Destructor of that object should be fired right after?
If @Arnaud_N wants to keep such object “alive” (like a window), probably he needs to hold such reference for the time he wants it existing, like in an app property, that will be auto released at the app ending time and that “window” closed.
If you allow ImplicitInstance on a window and, while the window is not yet shown, you call something on it (e.g MyImplicitWindow.Show), that’s the same thing: you don’t have any variable at all, visible in your code, holding that window.
Application.WindowCount and Application.Window() also rely on this.
I couldn’t find a reference to it in the LR or user’s guide. I bet it’s implicit.
Full agreement. I remember going to great lengths when I learnt Xojo, building more or less complicated and leaky references to windows when in reality none were needed because windows are self-referencing. Any class doing so (shell?) should say so in the docs, because this is somewhat an exception to normal OOP behaviour.
Any feedback ticket written?
This also just talk about implicit creation, not about the “no destruction” behavior of the class, even those not set as implicit creation. They need more details about the Xojo internal engine that captures those references, and because of that, even with their references been freed, like going out of scope, those objects (windows) will be unexpectedly kept alive and not destructed.