[Qt-qml] QML and Unix #!/path/to/interpreter

Alan Alpert alan.alpert at nokia.com
Tue Apr 20 09:29:43 CEST 2010


Tirsdag 20. april 2010 16:40:15 skrev du:
> On 04/19/2010 04:18 PM, Alpert Alan (Nokia-D-Qt/Brisbane) wrote:
> > It is not possible because the first line is not valid QML (starting
> > with #!).
> > Note that # will not start a comment in QML.
> 
> Yes, I realize that. However, the #! interpreter syntax is important
> enough that e.g. the authors of scsh (Scheme Shell)
> <http://www.scsh.net/docu/html/man-Z-H-2.html#node_sec_1.6.3> have
> decided to give it special treatment.

That is because it is a shell, and needs to be able to execute files just like 
bash (your shell scripts should always work regardless of your choice of 
shell). I fully agree that qmlsh, which you are welcome to start ;), should 
allow a #! syntax for its source files.

I have written scheme scripts and they do not treat #! specially. I needed to 
use an arcane starting line which starts with a ;, which is fortunately both 
the scheme comment char and a noop for bash. We have no such serendipity in 
QML.
 
> QML could be an extremely nifty tool for writing simple script style
> applications without compromising in the user interface front.
> Supporting the #! syntax would make it even more attractive, at least to
> me. And even more so to the hordes of Meego hackers already banging at
> the gates ;-)

Without #!, QML is still an extremely nifty tool for writing script style GUI 
applications. And from the GUI perspective, the important shortcut is that the 
QML interpreter is registered to open QML files when you click on them. QML is 
not currently recommended for creating command line UIs, and so it is not a 
very high priority to cut out the couple of extra chars required to type 'qml' 
before the file name.

We do hope that Meego hackers find QML useful, but QML is simply not a shell 
scripting language. Not yet at least.

-- 
Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks



More information about the Qt-qml mailing list