[Gambas-user] Internal compiler error with New
Tobias Boege
taboege at ...626...
Mon Jan 27 22:40:13 CET 2014
On Mon, 27 Jan 2014, Jussi Lahtinen wrote:
> Well ok, but I don't think that should be allowed syntax (at least I don't
> see any usage for it).
>
I do: the PathWatch class in gb.inotify or generally every object like this:
--8<-[ MyObject.class ]-----------------------------------------------------
Private $cObjects As New Collection
Public Sub _new(Name As String)
$cObjects[Name] = Me
Print "Hi, I'm";; Name;; "and I'm now referenced."
End
Static Public Sub _get(Name As String) As MyObject
Return $cObjects[Name]
End
--8<------------------------------------------------------------------------
Maybe MyObject sets itself up for sending events or something in _new().
Then you really only need to create the thing (with an event name) and
forget about it in the main program.
Regards,
Tobi
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list