Re: Small embeddable scripting language ?

Hi all

Thanks to all those who replied so far. From the discussion so far:

Owen: I absolutely agree with you on the language front - I'm inclined
to pick one and stick to it - that's why I started the thread.

Jens: Thanks for the JS and BSF pointers and other suggestions. I think
we really need something like BSF for GNOME. (But looks like you are
losing on the popularity front as far as JS is concerned ;-)

Sean: Thanks for the Scriptix pointer. However, looks like the popular
opinion is that an established and common language should be used.

Rob: Thanks for pointing out the JS limitations - I think you're right
in that we could be limiting our scope by using the language.

Malcolm,Dan, Nicholas, Owen, Patrik and all other Python supporters who
flooded my inbox so zealously: You guys win - I'm convinced Python is
the way to go :-) I'm going to be honest - I don't know Python :-( which
might have biased my responses. But from the pro-python posts, looks
like I'll have to start teaching myself Python real fast ;-)

J5: Thanks for pointing out something I hadn't considered - GTK
bindings. I thought it won't be required but the more I think about it,
the more it seems that it just might be required at a later stage.

Someone asked what the scope of scripting would be. There are mainly
three areas where I'm planning to use scripting:

1) Expose a simple API from the application to the scripting framework.
Some examples:
	Open a new text buffer
	Write to a text buffer
	Add a menu/toolbar item
	Add a file to the project
	Send a command to the debugger
Then the user can write simple scripts to do add features the IDE does
not provide, for example regular expression search/replace, or commands
for a new version control system.

2) A simple way of adding tools. Say, you want to add a menu item,
which, when invoked, will call a script with certain parameters. The
interaction with the IDE will be limited to passing command line
parameters and standard input and showing the output in one of the
message panes or as a popup. This doesn't need to be language specific,
of course (for example, you can simply add a tool meny 'Doxygen' which
will call doxygen from the top project directory.). But as I said
before, if we are going to add tools this way, I'd like to be consistent
about the language and conventions we follow.

3) As an embedded template language for code snippets and file and
project wizards. For example, you might want to add a code snippet for a
standard C header file:
** File name <%=echo $file_name%>
** Copyright <%=echo $current_year%> <%=echo $author_name%>

#ifndef <%=echo upper(canonical($file_name))%>
#define <%=echo upper(canonical(file_name))%>

#endif /* <%=echo upper(canonical($file_name))%> */

This would, for an example file simple.h output something like this on
my system:

** File name simple.h
** Copyright 2002 Biswapesh Chattopadhyay

#ifndef SIMPLE_H
#define SIMPLE_H

#endif /* SIMPLE_H */

This is a simple example - you can, of course, put full scripts there
which can do conditional code generation, etc. This would be useful for

In the long term, once the bindings mature, we can think about exposing
more of the internal interface (and this is where having GTK+ binding
might be a plus). I can think of a situation where a script might
register a callback like:
	Call me when a file is added to the project database
	Call me when a text buffer gets saved
	Call me when the user presses the X menu item
The script can then do stuff like create a GUI from a glade file and do
complex interaction with the user (wizards come to mind as an example).

So, that's the basic idea. Ultimately, I'd like as much of the IDE
functionality to be scriptable as possible, but, we'd better take it one
step at a time and try not to do too many things at once.

To conclude:
	1) Python it will be
	2) No generic language support
	3) I'll teach myself Python this weekend (as someone claimed, I should
be an expert by Monday ;-)

Thanks and regards,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]