> Log Message: > ----------- > Start to add support for speculative plugin loads. > > At present if libraries or symbols are missing, > Felix throws an exception which terminates the program. > Since catching exceptions is not really possible in Felix, > I want to provide functions that return an error code > instead of aborting. > > This might be used, for example, by the webserver, > trying to load a formatting routine based on a filename > extension. Plugins can then be written to support some > formats and made available to the webserver whilst it is running.
Well, this turns out to be a bit harder than I thought. With the current setup, it is possible find out if a library will load, but not if it will initialise. One tests loading by simply loading it then unloading it. If it is loadable .. you can load it again. Not very pleasant. However this doesn't check if a library will initialise. Even if the initialisation symbols exist, they might not work. In particular .. the library may load another one. On the other hand, a library can do arbitrary work on initialisation, in fact Felix programs are just library initialisations. For plugins, there's an extra initialisation function setup: string -> int as well. In fdoc2html setup loads other libraries. Now, if we do a speculative load for fdoc2html .. how do we load the libraries which for it are optional? If we use a speculative load for them, we may not get what we expect. After all then fdoc2html will say it loaded or can be loaded. But actually it is not completely loaded. So roughly speaking this is like const. It seemed like a good idea at the time but it is a virus. It invades everything. Exception handling isn't a good solution either. The problem is that, assuming you could catch them .. well you have no idea what exceptions might be thrown. An initialisation failure could be for many reasons, for example a library may try to load a configuration file and be unable to parse it. And of course, Felix cannot (reliably) catch C++ exceptions, because they unwind the machine stack, but Felix uses a heap allocated spaghetti stack. On the other hand speculative loading is more or less essential. One good example is a generic routine, hidden by a more specialised one. You try for the specialised one and fall back on the generic one. So you can get code working, and improve it later. So I will have to carefully design what a speculative load actually does. Probably it will return an error code if and only if the library doesn't exist. Otherwise any failure throws an exception as usual. That still doesn't provide any guidance for dependent libraries: basically the choice of how to handle them would be up to the library using one of them and not affected by how it itself was loaded (so the "speculative" concept would not propagate). -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language