Hi List,

I'm writing to describe an optional feature which I added to master, and an
optional and very small dependency I added which supports it. There was
some minor controversy on irc whether I should have mailed the list before
doing this -- I think in this case it is small enough and unimportant
enough that it's okay but I have figured that I should mail the list about
it anyways.

Earlier last week I tried to create a "lua interpreter console" dialog
where you can interactively send commands to the in-game lua. I did this
because I felt we were missing something like the "gamestate inspector" to
help inspect the lua state as a debugging aid, and I am anticipating that I
will develop more lua-based stuff in the near future. It is mostly working
and so a few days ago I called it finished after adding some bells and
whistles.

One of the features which I added was a command history. I looked around at
what most programming language interpreters do and it turns out that the
majority of them use GNU Readline for many reasons. Besides those written
in C, Readline is also available as a popular python module. Readline is
GPL v2 and apparently is good enough that some projects have switched to a
GPL license to take advantage of it:
http://en.wikipedia.org/wiki/GNU_Readline#Implications_of_GNU_Readline.27s_GPL_license

In fact readline is also an optional dependency of lua -- if we compiled
the lua folder in current master with appropriate symbol definitions, we
could create a stand-alone lua interpreter backed up by readline.

GNU history is the small subset of readline which is related to command
line history. Besides search and recall, it supports automatically saving
and recalling the history session to a file, and bash-style history
expansions in strings. I decided that it would probably be easier and more
interesting to use GNU history rather than reimplement something like this
based on std::vector<std::string> or whatever, surely a pretty menial task
if you don't care about the persistence or "expansions".

It took me about an hour or two read about it and implement it to my
satisfaction this way. It took me about another hour or two to successfully
cross-compile GNU history with mingw32 at gfgtdf's request. Thanks also to
gfgtdf for finding a bug in my implementation also.

Having done all this though, I'm not really about to argue or litigate to
add this as an official dependency -- frankly I don't really care. Only a
tiny fraction of users would actually use the lua console anyways, only if
they are developers or advanced UMC makers. Fewer still would even notice
or particularly care about a command line history feature. And I'm
certainly not willing to spend more time arguing about the feature than I
did implementing it, so I'm already pretty nearly tapped out in that regard.

Why put this on master then. Well, the fact is that this library is widely
available, it's a dependency of bash, so for instance most of our linux
users already have it installed. I have set up scons to search for the lib
by default, but if it fails then proceed without it. So it works like the
optional dbus-1 dependency. It didn't occur to me at the time that anyone
would think this course of action would be unreasonable, or would want to
argue about it -- it adds some minor convenience for some users without
inconveniencing anyone else.

In a way this is a pretty awkward email, because I'm not really interested
in starting a discussion, and I'm also not interested in rewriting or
revisiting the feature for really any reason. Rather I just don't want
anyone to jump to conclusions, feel miffed and say I inconvenienced them by
adding a stealth dependency. If everyone wants it to be removed, fine, I
don't intend to post in the topic again, I will just use the feature
privately myself. If everyone would much rather have a version of the
feature without the dependency, you are of course quite welcome to take
advantage of the space between #else and #endif.

For what it's worth if any of you need to write an interpreter for a
programming language in some other context, I would recommend the use of
readline, it seems quite good.

Best Regards,
Chris Beck

P.S. For anyone interested, here is a link to my cross-compiled version of
GNU history v 6.2.0, tested to work with my mingw32-compiled wesnoth.
http://goo.gl/lFz44P?gdriveurl
_______________________________________________
Wesnoth-dev mailing list
Wesnoth-dev@gna.org
https://mail.gna.org/listinfo/wesnoth-dev

Reply via email to