Suggestions and Stuff
Here's a smattering of ideas:
[Internationalization]
One neat thing that KDE (K Desktop Environment) has is a automatic
internationalization feature, something that I've been promising for
Win32Lib. For example, the code to set a menu item looks something like
this:
menu->insertItem( klocale->translate("File"), file );
The key function here is translate(), which returns the string as a word in
the currently selected language. Since most Windows applications seem to
share a fairly large set of common labels ("File", "Open", "Cancel"), it
doesn't take a huge dictionary to port 90% of an application to another
language. And the neat thing is that it's done automatically, so you don't
have to have seperate resource files.
Sure, the more complex messages are not handled, but I think it would
certainly be a major step in the right direction.
I could probably go spelunking through KDE and find the lookup table, but
perhaps someone out there is more motivated that I am, and can do it
faster - or at least a list of words could be compiled. It seems to me that
such a function would be a nice addition to virtually any Euphoria
application, from Win32Lib to video games.
[Automatic Updates]
One of the features on a lot of programs coming out these days is the
ability to check on the web for the most current version of the code. This
might also make a nice addition to Euphoria, although I suspect that it
would only work for unbound programs, for obvious reasons. For example, it
would take care of the problem of not having the most up-to-date libraries
installed in an application, or perhaps just not having the most current
version of a program.
Any takers? Perhaps if it was written, Robert could donate a web page for
Euphoria programs with an auto-update feature, so there would be a stable
web page to post updates to.
[Messages and Namespace]
As with most OOP programs in Euphoria (Quartz also comes to mine), the
rewrite of Win32Lib grapples with the question of passing messages as
strings or integers. For example:
send( window, "open", {} )
or:
send( window, OPEN, {} )
The advantage of using strings is that you don't get conflicts between
classes. That is, if I define a class FOO that uses SET as a message and you
define a class BAR that uses the message SET, there is a conflict. Languages
like C++ avoid the name conflict by binding the name to the class, so
FOO.SET and BAR.SET don't collide.
The down side is that strings are slower - especially since Euphoria
optimizes integer stuff. And there is more overhead with having to pass
strings. What to do?
One option I've been toying with is setting up a dictionary along these
lines:
sequence registry
registry = {}
global function register( sequence s )
-- return the index of s in the registry
integer index
-- has the word been registered yet?
index = find( s, registry )
if index then
return index
end if
-- add the word to the registry
registry = append( registry, s )
-- return index
return length( registry )
end function
So you can define your messages as local constants:
constant
xSet = register( "set" ),
xGet = register( "get" )
and they will map to the same index from one include file to the next, but
you won't have to worry about name conflicts, since the constants are all
declared locally. So xSet and xGet are scoped to their include file (which
is the same as their class), much in the same way as C++ does it.
Comments?
-- David Cuny
|
Not Categorized, Please Help
|
|