Re: init.e - standard library candidate
- Posted by EUWX Mar 09, 2013
- 1719 views
I came up with a small file that makes it easier to make code (especially GUI code) more modular. Think of a Win32Lib or wxEuphoria application, where you would create all of your widgets and assign them to constants. This gets really unwieldy for large apps. And when you start splitting code into multiple files, you have to be careful that they're included in the right order so that things get initialized properly.
So I came up with init.e, and I've found myself using it in lots of projects, and it seems like the sort of thing others might find useful:
The idea is that you call init:register( "some name" ) (it defaults to a procedure named init(), but you can put whatever you want). And then inside of you init's, you can call init:ensure( "some dependency" )), which will cause that init routine to be called if it hasn't already.
And you just call init:all() at the bottom of your main program, or just before you call WinMain() or whatever.
Matt
Looks nice. But I am a dimwit. is there a possibility of seeing an example or two?
Thanks