1. RE: load user defined module
Hi,
"If" any changes are to made to the include mechanism .... surely it
must be to be able to include a file based on the contents of a
sequence???
sequence my_include
if platform() = UNIX then
my_include "lui.e"
elsif platform() = WIN32 then
my_include = "wui.e"
elsif platform() = DOS32 then
my_include = "dui.e"
else
-- not supported
end if
include {my_include}
Somehow the "sequence include" needs to be different from the current
include so eu doesn't go looking for the file "my_include".
Here for example I added { } ... I'm not a language designer, maybe
others have a better way to distinguish between "file includes" and
"sequence includes" ???
Given:
include include_name
Some might suggest ... if a sequence exists called "include_name" use
the sequence, else look for a file.
This would work ... but isn't backawards compatiable if someone happens
to have a sequence name the same as a current include filename.
Not probable ... but possible.
Given that most if not all people use include extensions like .e .ew
it might be worth considering???
Regards,
Ray Smith
http://rays-web.com
petelomax at blueyonder.co.uk wrote:
> On Sat, 9 Nov 2002 00:26:38 +1100, Derek Parnell
> <ddparnell at bigpond.com> wrote:
>
> >Robert,
> <that's my middle name>
>
> >is this the sort of thing you are suggesting for us ? ...
> >
> >include linux/ui.e as lui
> >include win32/ui.e as wui
> >include dos/ui.e as dui
> >.
> >.
> >function CreateWidget( object WidgetType, object Caption, ... )
> > object lResult
> >
> > if platform() = UNIX then
> > lResult = lui:CreateWidget(WidgetType, Caption, ...)
> > elsif platform() = WIN32 then
> > lResult = wui:CreateWidget(WidgetType, Caption, ...)
> ....
> <snip>
> Is there any problem launching the app from stub files:
>
> app.ex:
> include dos/ui.e
> include main.e
>
> app.exw:
> include win32/ui.e
> include main.e
>
> app.exu:
> include linux/ui.e
> include main.e
>
> Providing the three variants of ui.e have a consistent api which you
> are suggesting then main.e need only contain platform independent code
> & no calls to platform() either.
>
> I think it would be a mistake to actually include say win32lib.ew when
> running on say linux where it is never going to get called.
>
> Pete