Shortly the first implementation (compiler) will be released, using the FPC back-end to power itself.
Consider a few examples:
b Out('hello'); e.
proc DoThis(v ByRef: int; c ReadOnly: astring; ByVal: int); b Out('code goes here'); Out('code goes here'); Out('code goes here'); e;
Pretend we have some html templates (files with extension .tpl) that we wish to output. Here is a simple example of how Qomp looks using Powtils to display an input form or some content, depending on whether a request was posted:
use PWInit, PWMain, PWFileUtil; type TplItem = (header, content, form1, footer); c TplNames = ray [TplItem] of astring = ( 'header.tpl', 'content.tpl', 'form1.tpl', 'footer.tpl'); proc ShowContent; v title, tplfile: astring; b if not IsPostVar('posted') do b title =. 'Example Form'; tplfile =. TplNames[form1]; e els b title =. 'Example Page'; tplfile =. TplNames[content]; e; SetVar('title', title); TemplateOut(tplfile); e; proc ShowPage; b TemplateOut(TplNames[header]); ShowContent; TemplateOut(TplNames[footer]); e; func TemplatesMissing: boo; v i: TplItem; b res =. false; for i =. low(tplnames) to high(tplnames) go if not FileThere(TplNames[i]) do exit(true); e; proc HaltErr(msg: astring); b OutLn(msg); Halt; e; b if TemplatesMissing do HaltErr('Missing html template file!'); ShowPage; e.
uses PWInit, PWMain, PWFileUtil; type tplItem = (tHeader, tContent, tForm1, tFooter); const tplNames = array [tplItem] of ansistring = ( 'header.tpl', 'content.tpl', 'form1.tpl', 'footer.tpl'); procedure showContent; var title, tplFile: ansistring; begin if not isPostVar('posted') then begin title := 'Example Form'; tplFile := tplNames[tForm1]; end else begin title := 'Example Page'; tplFile := tplNames[tContent]; end; setVar('title', title); templateOut(tplFile); end; procedure showPage; begin templateOut(tplNames[tHeader]); showContent; templateOut(tplNames[tFooter]); end; function templatesMissing: boolean; var i: tplItem; begin result := false; for i := low(tplNames) to high(tplNames) do if not fileThere(tplNames[i]) then exit(true); end; procedure haltErr(msg: ansistring); begin outln(msg); halt; end; begin if templatesMissing then haltErr('Missing html template file!'); showPage; end.
One can see that cute large "BEGIN" and "END" keywords have been reduced and simplified to a more practical, and elegant, poetic notation. One can also see that the big CONST keyword is reduced to "C" and the VAR keyword reduced to "V". Procedures and methods that use CONST read only params really benefit from this reduction. Algorithms that make use of BEGIN and END, along with case statements, really reap the benefit of the shorter "B" and "E". When the larger "CONST" and "VAR" words are used for paramater behavior specification, these large clunky words are spattered all over an interface or header - and the source becomes harder to read, and parameters span across the screen far (often past the 80 column marker).
For more on that, see the article Serious Problems of Verbosity