Difference between revisions of "Visual Prolog 7.2 New Features"

From wiki.visual-prolog.com

 
(49 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=New Features in Visual Prolog 7.2=
Visual Prolog 7.2 introduces many new features and improvements.
 
The new release improves Visual Prolog stability and includes a lot of bug fixes.
 
Visual Prolog 7.2 also incorporates all changes included into the minor releases of Visual Prolog 7.1 (Builds 7102, 7103).


Visual Prolog 7.2 introduces many new features and improvements.
Following are the most significant changes.
Following are the most significant changes.


==''' 1 Language Features '''==
== Language Features ==


Visual Prolog 7.2 brings several language improvements. This section gives a brief overview of some of them.
Visual Prolog 7.2 brings several language improvements. This section gives a brief overview of some of them.


==='''1.1 Anonymous predicates '''===
=== Anonymous predicates ===
 
Anonymous predicates are the Prolog counterparts to anonymous functions as known in functional programming languages. Anonymous predicates are described in details in the article ''[http://wiki.visual-prolog.com/index.php?title=Language_Reference/Terms/Anonymous_Predicates Anonymous Predicates]'' of Visual Prolog Language Reference.
 
=== 64 bit numbers ===


Anonymous predicates are the Prolog counterparts to anonymous functions as known in functional programming languages. Anonymous predicates are described in details in the paper ''Anonymous Predicates'', and presented in a separate session at the VIP-ALC 2008 conference.
<vp>integer64</vp> and <vp>unsigned64</vp> are two new built-in types, that replace the PFC domains '''core::integer64''' and '''core::unsigned64'''. The new domains are like integer and unsigned expect that they have a 64-bit representation. All arithmetic operations (except the power operation) are supported for the types. They are written, read, saved and consulted in normal number format only with much larger range than 32-bit numbers. PFC has been updated to use <vp>integer64</vp> and <vp>unsigned64</vp> instead of <vp>core::integer64</vp> and <vp>core::unsigned64</vp>. So now (as example) file positions are <vp>unsigned64</vp>. The same is the case with <vp>gmtTimeValue</vp>, <vp>localTimeValue</vp> and <vp>timeIntervalValue</vp>.


==='''1.2 64 bit numbers '''===
=== Namespaces ===


''' integer64''' and '''unsigned64''' are two new built-in types, that replace the PFC domains '''core::intege r64''' and '''core::unsigned64'''. The new domains are like integer and unsigned expect that they have a 64-bit representation. All arithmetic operations (except the power operation) are supported for the types. They are written, read, saved and consulted in normal number format only with much larger range than 32-bit numbers. PFC has been updated to use '''integer64''' and '''unsigned64''' instead of '''core::integer64''' and '''core::unsigned64'''. So now (as example) file positions are '''unsigned64'''. The same is the case with '''gmtTimeValue''', '''localTimeValue''' and '''timeIntervalValue'''.
Interfaces and classes can be put into namespaces (like <vp>pfc\pie</vp>). This allows the same interface/class name to be declared/defined in several name spaces in the same program. So, now it is possible (for example) to have a class called <vp>file</vp> in the namespace <vp>documentManager</vp> even though there is also a class named <vp>file</vp> in PFC. It is planned in a future version of Visual Prolog to put PFC classes in namespaces <vp>pfc</vp>, <vp>pfc\vip5x</vp> and <vp>pfc\gui</vp>. Also there are new <vp>pie</vp> packages (described below) in the namespace <vp>pfc\pie</vp>.


==='''1.3 Namespaces '''===
=== binaryNonAtomic domain ===


Interfaces and classes can be put into name-spaces (like '''pfc\pie'''). This allows the same interface/class name to be declared/defined in several name spaces in the same program. So now it is possible (as example) to have a class called '''file ''' in the namespace '''documentManager''' even though there is also a class named '''file''' in PFC. It is planned (but not effectuated at the time of writing) to put PFC classes in namespaces '''pfc''', '''pfc\vip5x '''and''' pfc\gui'''. Also the new '''pie''' packages (described below) are in the name space ''' pfc\pie'''.
A new built-in domain <vp>binaryNonAtomic</vp> is introduced to distinguish binaries may contain pointers and should therefore be scanned by the garbage collector. The ordinary <vp>binary</vp> domain is no longer scanned for pointers.


==='''1.4 binaryNonAtomic domain '''===
=== real32 ===


A new built-in domain '''binaryNonAtomic''' is introduced to distinguish binaries may contain pointers and should therefore be scanned by the garbage collector. The ordinary '''binary''' domain is no longer scanned for pointers.
A domain <vp>real32</vp> is introduced to ease the integration with foreign API's that sometimes uses such short reals. It is not intended for use in "normal" code.


==='''1.5 real32 '''===
=== handle ===


A domain ''' real32''' is introduced to ease the integration with foreign API's that sometimes uses such short reals. It is not intended for use in "normal" code.
A new built-in domain <vp>handle</vp> which corresponds to API handle type is introduced to ease the integration with foreign API's as well. Also, there are two new built-in constants of this type: <vp>nullHandle</vp> and <vp>invalidHandle</vp>.


==''' 2 Compiler '''==
=== Compiler directive #options ===
 
A new compiler directive <vp>#options</vp> is introduced to define some additional compiler options for a separate compilation init. It has the following syntax:
 
<vipbnf><OptionsDirective>:
    #options <StringLiteral></vipbnf>
       
This directive affects the whole compilation unit and should be used outside scopes and conditional compilation statements in the main source file for a compilation unit (i.e. in the source file which is passed to the compiler). Otherwise the compiler generates warning message and ignores the directive. The '''<string_literal>''' can only contain the following compiler's options: '''/Warning''', '''/Check''', '''/NOCheck''', '''/Optimize''', '''/DEBug''', '''/GOAL''', '''/MAXErrors''' and '''/MAXWarnings'''. Otherwise the compiler generates error message for invalid option.
 
== Compiler ==


The compiler is (obviously) updated to deal with the new language features. But it has also been improved in several other respects.
The compiler is (obviously) updated to deal with the new language features. But it has also been improved in several other respects.


==='''2.1 Unreachable code detection '''===
=== Unreachable code detection ===


The ability to detect unreachable code has been improved vastly, both when it comes to detecting unused predicates and facts and when it comes to code inside clauses which cannot be reached. Unreachable code will cause warnings.
The ability to detect unreachable code has been improved vastly, both when it comes to detecting unused predicates and facts and when it comes to code inside clauses which cannot be reached. Unreachable code will cause warnings.


==='''2.2 Superfluous test detection '''===
=== Superfluous test detection ===


The compiler will also give warnings about tests, which are trivially fulfilled due to the type of the involved variables. Consider this code for example:
The compiler will also give warnings about tests, which are trivially fulfilled due to the type of the involved variables. Consider this code for example:


<vip>
<vip>clauses
clauses
     ppp(X) :-  
     ppp(X) :-  
         Y = X - 23,  
         Y = X - 23,  
         Y >= ,   
         Y >= 0,   
         qqq(Y).</vip>
         qqq(Y).</vip>


where '''qqq''' is declared like this:  
where <vp>qqq</vp> is declared like this:  


<vip>
<vip>predicates
predicates
       qqq : (positive V). </vip>
       qqq : (positive V). </vip>
The code above might seem reasonable, we only want to call '''qqq''' if Y is indeed greater than or equal to zero.
     
The code above might seem reasonable, we only want to call <vp>qqq</vp> if Y is indeed greater than or equal to zero.


The only problem is Y is always greater than zero, because Y has the type positive, which only contains numbers that are greater than or equal to zero.  
The only problem is Y is always greater than zero, because Y has the type positive, which only contains numbers that are greater than or equal to zero.  


If the calculation X 23 gives a negative number an out-of-range exception will be raised ('''''before''''' reaching the test).  
If the calculation <vp>X - 23</vp> gives a negative number an out-of-range exception will be raised ('''''before''''' reaching the test).  
So this new warning can help the programmer detect places where it seems that testing ensures validity of the code, while in reality the test will never fail because an exception will be raised instead. The code above can be corrected using this code:  
So this new warning can help the programmer detect places where it seems that testing ensures validity of the code, while in reality the test will never fail because an exception will be raised instead. The code above can be corrected using this code:  
<vip>
clauses
ppp(X) :-
Y = tryConvert(positive, X - 23),
qqq(Y).
</vip>
If X  -  23 gives a negative number, the '''tryConvert''' will fail.


==='''2.3 Smaller code '''===
<vip>clauses
  ppp(X) :-
      Y = tryConvert(positive, X - 23),
      qqq(Y).</vip>
     
If <vp>X - 23</vp> gives a negative number, the <vp>tryConvert</vp> will fail.
 
=== Smaller code ===


The size of the generated code has become smaller, especially for predicates with many clauses that match different patterns of input.
The size of the generated code has become smaller, especially for predicates with many clauses that match different patterns of input.


==='''2.4 Less stack usage '''===
=== Less stack usage ===


Likewise, the stack size has been reduced (dramatically in some cases).
Likewise, the stack size has been reduced (dramatically in some cases).


==''' 3 IDE '''==
=== The sub-type relations for some built-in types were changed ===
 
The built-in types <vp>string</vp>, <vp>object</vp>, <vp>string8</vp> and <vp>symbol</vp> are not sub-types of type <vp>pointer</vp> any more.
 
=== Restrictions for delegate- sections order were removed ===
 
Now <vp>delegate</vp>- sections can be mixed with "usual" sections  (like predicates, etc.) inside a class implementation.
 
== IDE ==


Many bugs and inconveniences have been solved in the IDE. Just like numerous smaller and larger improvements has been made. This section describes some of the major improvements.
Many bugs and inconveniences have been solved in the IDE. Just like numerous smaller and larger improvements has been made. This section describes some of the major improvements.


==='''3.1 Build speed '''===
=== Build speed ===


The build system has been changed such that it can utilize multi-core processors by compiling several packages in parallel. On a quad-core processor this typically gives a factor 4 (sometimes more) when many packages needs to be compiled.
The build system has been changed such that it can utilize multi-core processors by compiling several packages in parallel. On a quad-core processor this typically gives a factor 4 (sometimes more) when many packages needs to be compiled.
As a drawback the computer is not very responsive while building, because all the cores are kept quite busy.


As of this writing, we are also working on letting the compiler itself compile several packages in a single invocation and thus skip many compiler phases for files that are included in several packages.
As of this writing, we are also working on letting the compiler itself compile several packages in a single invocation and thus skip many compiler phases for files that are included in several packages.
Line 88: Line 109:
This feature has given a factor 4 when rebuilding a ''very'' large project.
This feature has given a factor 4 when rebuilding a ''very'' large project.


The two features have not yet been tested together, so it is too early to say something about the combined improvement.
=== IntelliSence ===
 
==='''3.2 IntelliSence '''===


Browse information (i.e. information about the source code fed from the compiler back to the IDE) is now utilized to provide IntelliSense: When you edit source code the IDE shows possible/sensible completion of the word you are typing. You can then select the completion in the list using mouse, arrow keys and TAB; the IDE will complete the word with your choice. The IDE will also show tool tip windows showing the declaration of the predicate you are about to write arguments for. That way you can see which arguments the predicate takes without changing context.
Browse information (i.e. information about the source code fed from the compiler back to the IDE) is now utilized to provide IntelliSense: When you edit source code the IDE shows possible/sensible completion of the word you are typing. You can then select the completion in the list using mouse, arrow keys and '''TAB'''; the IDE will complete the word with your choice. The IDE will also show tool tip windows showing the declaration of the predicate you are about to write arguments for. That way you can see which arguments the predicate takes without changing context.


==='''3.3 Window Navigation Dialog '''===
=== Window Navigation Dialog ===


The order, in which Ctrl-TAB shifts between IDE windows, has been changed to visit most-recently-visited windows first.
The order, in which '''Ctrl-TAB''' shifts between IDE windows, has been changed to visit most-recently-visited windows first.


Furthermore, Ctrl-TAB also brings up a navigation dialog listing all the open windows. The dialog stays up as long as Ctrl-key is pressed. In this dialog you can see the windows in the order they will be shifted to, but you can also choose a window directly using the mouse or the arrow keys. If you press letters the list will be filtered to
Furthermore, '''Ctrl-TAB''' also brings up a navigation dialog listing all the open windows. The dialog stays up as long as '''Ctrl'''-key is pressed. In this dialog you can see the windows in the order they will be shifted to, but you can also choose a window directly using the mouse or the arrow keys. If you press letters the list will be filtered to windows starting with the letters you have pressed.


windows starting with the letters you have pressed.
'''Ctrl-Del''' will close the selected window.


==='''3.4 Grouping editor windows '''===
=== Grouping editor windows ===


Editor windows can be grouped together to look and behave like a single window. This has the advantage that you can arrange windows in a fixed layout inside the IDE. The IDE will remember two different layouts, one for "normal" mode and one for debug mode. Typically, you want large editor windows in "normal" mode, but smaller editors in debug mode to give more room for the variables window, etc.
Editor windows can be grouped together to look and behave like a single window. This has the advantage that you can arrange windows in a fixed layout inside the IDE. The IDE will remember two different layouts, one for "normal" mode and one for debug mode. Typically, you want large editor windows in "normal" mode, but smaller editors in debug mode to give more room for the variables window, etc.


==='''3.5 Resources view in project tree '''===
=== Resources view in project tree ===


When selecting a resource (e.g. a dialog or a bitmap) in the project tree, the right pane will show a preview of the resource.
When selecting a resource (e.g. a dialog or a bitmap) in the project tree, the right pane will show a preview of the resource.


==='''3.6 Zooming '''===
=== Zooming ===
 
Pressing the '''Ctrl''' and using the mouse wheel the IDE will increase/decrease font size in various windows creating a zoom effect. Zooming is also bound to '''Ctrl-+''', '''Ctrl--''', and '''Ctrl-0''' reset the zoom to 100%.
 
=== Un-/commenting blocks ===
 
The editor has new commands for commenting and un-commenting a block of code with %-chars. The commands are bound to '''Ctrl-Alt-%''' and '''Ctrl-Alt-Shift-%'''. (It would be more correct to state the keys as Ctrl-Alt-5 and Ctrl-Alt-Shift-5, but it seems simpler to remember the %-key).
 
=== Project loading speed ===
 
The project loading has been changed such that the speed of this process was increased.


Pressing the Ctrl and using the mouse wheel the IDE will increase/decrease font size in various windows creating a zoom effect. Zooming is also bound to Ctrl-+, Ctrl--, and Ctrl-0 reset to 100%.
=== Find In Files dialog ===


==='''3.7 Un-/commenting blocks '''===
The dialog '''Find In Files''' has been improved such that it now shows total number of found entries in a file as well.


The editor has new commands for commenting and un-commenting a block of code with %-chars. The commands are bound to Ctrl-Alt-% and Ctrl-Alt-Shift-%. (It would be more correct to state the keys as Ctrl-Alt-5 and Ctrl-Alt-Shift-5, but it seems simpler to remember the %-key).
=== Welcome Page ===


==''' 4 PFC '''==
The '''Welcome Page''' has been improved such that now it has an extra context menu which can be accessed via right mouse. This menu allows to inspect project file properties, remove project from the list of projects, etc.
 
=== TODO Window ===
 
It is now possible to view all '''TODO comments''' (i.e. the comments like % TODO) in source files which can be rather convenient for developers. This feature is available via the Main menu: View | TODO
 
== PFC ==


PFC has mainly been consolidated, updated to 64-bit numbers and things like that. But there are also some new things.
PFC has mainly been consolidated, updated to 64-bit numbers and things like that. But there are also some new things.


==='''4.1 PIE '''===
=== PIE ===


The engine of PIE (Prolog Interpreter Engine) is now added to PFC and will therefore be supported as a tool in future. The most important feature is that you can easily hook-in predicates from you own application. Subsequently, the PIE programs can manipulate your application. So PIE is very useful as a scripting engine in applications. Besides this, the efficiency has been improved and PIE now supports functions and real numbers.
The engine of PIE (Prolog Interpreter Engine) is now added to PFC and will therefore be supported as a tool in future. The most important feature is that you can easily hook-in predicates from you own application. Subsequently, the PIE programs can manipulate your application. So PIE is very useful as a scripting engine in applications. Besides this, the efficiency has been improved and PIE now supports functions and real numbers.


==='''4.2 progressBarControl '''===
=== progressBarControl ===


A progressBarControl binds to the win32 common control progress bar. It is the intension to add additional win32 common controls, but to deal more easily with them certain inner parts of PFC GUI will have to be revised first.
A progressBarControl binds to the win32 common control progress bar. It is the intension to add additional win32 common controls, but to deal more easily with them certain inner parts of PFC GUI will have to be revised first.


==='''4.3 postAction '''===
=== postAction ===
 
A new predicate <vp>postAction</vp> on the <vp>window</vp> class, makes it possible to post an action to any window. The action will be packed in a user message and when the user message is handled the action is executed. Together with anonymous predicates this makes any other use of user messages superfluous.
 
=== popupWindow ===
 
A new class <vp>popupWindow</vp> makes it easier to create popup windows like tooltips. Most importantly popup windows must have the screen as parent so that they can be drawn outside their logical owner and on top of other windows.
 
=== radixTree ===
 
A radix tree is a map from <vp>pointer</vp> to any type. Its main advantage (over for example red-black-trees) is that supports very efficient merge of several maps. The disadvantage is that the keys are pointer values, so the trees can only be used on things with unique pointers (like <vp>object</vp> and <vp>symbol</vp>).
 
=== uxTheme native bindings ===
 
Native bindings to uxTheme make it possible to experiment with creating '''''theme aware''''' controls. Theme aware controls are not drawn using lines, circles, rectangles, etc. Instead they are drawn using '''''theme elements'''''. Theme elements are logical graphical entities like divider line, button surface, button outline, drop-down mark, etc. You combine/draw such logical elements into your control, and when the theme changes your control will also change appearance. If you have chosen the elements wisely your control will also blend-in with other themes.
 
=== getFactChainLength_nd ===
 
A new predicate <vp>getFactChainLength_nd</vp> (in the <vp>profileMemory</vp> class) returns the number of facts in each class fact chain in the entire program. It is intended to help tracking down problems with class facts that are not retracted when they should and therefore eats memory by keeping data alive that should have been dead.
 
=== weakPointer ===
 
Weak pointers are "pointers" that the garbage collector does not see as pointers, so if there are only weak pointers to a piece of memory the garbage collector will recycle that piece of memory. As a consequence, a weak pointer cannot always be dereferenced, sometimes the target as been recycled. Dereferencing of a weak pointer it therefore done using a <vp>determ</vp> predicate.
 
So in short a weak pointer is a pointer that will not keep memory alive.
 
=== 5xChainDB8 ===
 
This package is introduced for compatibility support in order to handle old external databases (where strings are not in Unicode).
 
== Tools ==
 
=== vipBuilder ===


A new predicate '''postAction''' on the '''window''' class, makes it possible to post an action to any window. The action will be packed in a user message and when the user message is handled the action is executed. Together with anonymous predicates this makes any other use of user messages superfluous.
Some extra options has been added to '''vipBuilder''':
    /genresource - also generate resourceIdentifiers.i
    /compile <file_name> - compile the file <file_name>


==='''4.4 popupWindow '''===
=== coverageAnalysis ===


A new class ''' popupWindow''' makes it easier to create popup windows like tooltips. Most importantly popup windows must have the screen as parent so that they can be drawn outside their logical owner and on top of other windows.
The '''coverage analysis''' gives information about the predicates that have been called during execution of the program. The coverage analysis program reads '''.deb''' files to get information about a set of classes and predicates in a program and coverage files to get information about the predicates that have been called during execution of the program. The program must be compiled with options '''/profile:min''' and '''/debug:full''' to use this new tool.


==='''4.5 radixTree '''===
== Updates ==


A radix tree is a map from '''pointer''' to any type. Its main advantage (over for example red-black-trees) is that supports very efficient merge of several maps. The disadvantage is that the keys are pointer values, so the trees can only be used on things with unique pointers (like '''object''' and '''symbol''').
=== Build 7202 ===


==='''4.6 uxTheme native bindings '''===
'''Visual Prolog 7.2, Build 7202''' fixes a number of bugs [http://kb.visual-prolog.com/fixes/fixes7202.htm the bugs fixed in the Build 7202].


Native bindings to uxTheme make it possible to experiment with creating '''''theme''''' ''' ''aware''''' controls. Theme aware controls are not drawn using lines, circles, rectangles, etc. Instead they are drawn using '''''theme elements'''''. Theme elements are logical graphical entities like divider line, button surface, button outline, drop-down mark, etc. You combine/draw such logical elements into your control, and when the theme changes your control will also change appearance. If you have chosen the elements wisely your control will also blend-in with other themes.
The following new feature has been implemented in accordance with the [http://discuss.visual-prolog.com/viewtopic.php?t=7980? user request] in [http://discuss.visual-prolog.com/ Visual Prolog Discussion Forum]: 


==='''4.7 getFactChainLength_nd '''===
* Add moving listener/responder to splitTwoControl


A new predicate '''getFactChainLength_nd''' (in the '''profileMemory''' class) returns the number of facts in each class fact chain in the entire program. It is intended to help tracking down problems with class facts that are not retracted when they should and therefore eats memory by keeping data alive that should have been dead.
== See also ==
=== Bugs Fixed in Visual Prolog 7.2 ===
[http://kb.visual-prolog.com/fixes/fixes7201.htm Bugs Fixed in Visual Prolog 7.2, Build 7201]


==='''4.8 weakPointer '''===
[http://kb.visual-prolog.com/fixes/fixes7202.htm Bugs Fixed in Visual Prolog 7.2. Build 7202]


Weak pointers are "pointers" that the garbage collector does not see as pointers, so if there are only weak pointers to a piece of memory the garbage collector will recycle that piece of memory. As a consequence, a weak pointer cannot always be dereferenced, sometimes the target as been recycled. Dereferencing of a weak pointer it therefore done using a '''determ''' predicate.
=== Visual Prolog 7.2 Upgrade Notes ===
[[Visual Prolog 7.2 Upgrade Notes]]


So in short a weak pointer is a pointer that will not keep memory alive<font size="11.0pt">. </font>
[[Category:Release Notes|7.2 New Features]]

Latest revision as of 11:57, 14 May 2018

Visual Prolog 7.2 introduces many new features and improvements.

The new release improves Visual Prolog stability and includes a lot of bug fixes.

Visual Prolog 7.2 also incorporates all changes included into the minor releases of Visual Prolog 7.1 (Builds 7102, 7103).

Following are the most significant changes.

Language Features

Visual Prolog 7.2 brings several language improvements. This section gives a brief overview of some of them.

Anonymous predicates

Anonymous predicates are the Prolog counterparts to anonymous functions as known in functional programming languages. Anonymous predicates are described in details in the article Anonymous Predicates of Visual Prolog Language Reference.

64 bit numbers

integer64 and unsigned64 are two new built-in types, that replace the PFC domains core::integer64 and core::unsigned64. The new domains are like integer and unsigned expect that they have a 64-bit representation. All arithmetic operations (except the power operation) are supported for the types. They are written, read, saved and consulted in normal number format only with much larger range than 32-bit numbers. PFC has been updated to use integer64 and unsigned64 instead of core::integer64 and core::unsigned64. So now (as example) file positions are unsigned64. The same is the case with gmtTimeValue, localTimeValue and timeIntervalValue.

Namespaces

Interfaces and classes can be put into namespaces (like pfc\pie). This allows the same interface/class name to be declared/defined in several name spaces in the same program. So, now it is possible (for example) to have a class called file in the namespace documentManager even though there is also a class named file in PFC. It is planned in a future version of Visual Prolog to put PFC classes in namespaces pfc, pfc\vip5x and pfc\gui. Also there are new pie packages (described below) in the namespace pfc\pie.

binaryNonAtomic domain

A new built-in domain binaryNonAtomic is introduced to distinguish binaries may contain pointers and should therefore be scanned by the garbage collector. The ordinary binary domain is no longer scanned for pointers.

real32

A domain real32 is introduced to ease the integration with foreign API's that sometimes uses such short reals. It is not intended for use in "normal" code.

handle

A new built-in domain handle which corresponds to API handle type is introduced to ease the integration with foreign API's as well. Also, there are two new built-in constants of this type: nullHandle and invalidHandle.

Compiler directive #options

A new compiler directive #options is introduced to define some additional compiler options for a separate compilation init. It has the following syntax:

OptionsDirective:
    #options StringLiteral

This directive affects the whole compilation unit and should be used outside scopes and conditional compilation statements in the main source file for a compilation unit (i.e. in the source file which is passed to the compiler). Otherwise the compiler generates warning message and ignores the directive. The <string_literal> can only contain the following compiler's options: /Warning, /Check, /NOCheck, /Optimize, /DEBug, /GOAL, /MAXErrors and /MAXWarnings. Otherwise the compiler generates error message for invalid option.

Compiler

The compiler is (obviously) updated to deal with the new language features. But it has also been improved in several other respects.

Unreachable code detection

The ability to detect unreachable code has been improved vastly, both when it comes to detecting unused predicates and facts and when it comes to code inside clauses which cannot be reached. Unreachable code will cause warnings.

Superfluous test detection

The compiler will also give warnings about tests, which are trivially fulfilled due to the type of the involved variables. Consider this code for example:

clauses
     ppp(X) :- 
         Y = X - 23, 
         Y >= 0,  
        qqq(Y).

where qqq is declared like this:

predicates
      qqq : (positive V).

The code above might seem reasonable, we only want to call qqq if Y is indeed greater than or equal to zero.

The only problem is Y is always greater than zero, because Y has the type positive, which only contains numbers that are greater than or equal to zero.

If the calculation X - 23 gives a negative number an out-of-range exception will be raised (before reaching the test). So this new warning can help the programmer detect places where it seems that testing ensures validity of the code, while in reality the test will never fail because an exception will be raised instead. The code above can be corrected using this code:

clauses
   ppp(X) :-
       Y = tryConvert(positive, X - 23),
       qqq(Y).

If X - 23 gives a negative number, the tryConvert will fail.

Smaller code

The size of the generated code has become smaller, especially for predicates with many clauses that match different patterns of input.

Less stack usage

Likewise, the stack size has been reduced (dramatically in some cases).

The sub-type relations for some built-in types were changed

The built-in types string, object, string8 and symbol are not sub-types of type pointer any more.

Restrictions for delegate- sections order were removed

Now delegate- sections can be mixed with "usual" sections (like predicates, etc.) inside a class implementation.

IDE

Many bugs and inconveniences have been solved in the IDE. Just like numerous smaller and larger improvements has been made. This section describes some of the major improvements.

Build speed

The build system has been changed such that it can utilize multi-core processors by compiling several packages in parallel. On a quad-core processor this typically gives a factor 4 (sometimes more) when many packages needs to be compiled.

As of this writing, we are also working on letting the compiler itself compile several packages in a single invocation and thus skip many compiler phases for files that are included in several packages.

This feature has given a factor 4 when rebuilding a very large project.

IntelliSence

Browse information (i.e. information about the source code fed from the compiler back to the IDE) is now utilized to provide IntelliSense: When you edit source code the IDE shows possible/sensible completion of the word you are typing. You can then select the completion in the list using mouse, arrow keys and TAB; the IDE will complete the word with your choice. The IDE will also show tool tip windows showing the declaration of the predicate you are about to write arguments for. That way you can see which arguments the predicate takes without changing context.

Window Navigation Dialog

The order, in which Ctrl-TAB shifts between IDE windows, has been changed to visit most-recently-visited windows first.

Furthermore, Ctrl-TAB also brings up a navigation dialog listing all the open windows. The dialog stays up as long as Ctrl-key is pressed. In this dialog you can see the windows in the order they will be shifted to, but you can also choose a window directly using the mouse or the arrow keys. If you press letters the list will be filtered to windows starting with the letters you have pressed.

Ctrl-Del will close the selected window.

Grouping editor windows

Editor windows can be grouped together to look and behave like a single window. This has the advantage that you can arrange windows in a fixed layout inside the IDE. The IDE will remember two different layouts, one for "normal" mode and one for debug mode. Typically, you want large editor windows in "normal" mode, but smaller editors in debug mode to give more room for the variables window, etc.

Resources view in project tree

When selecting a resource (e.g. a dialog or a bitmap) in the project tree, the right pane will show a preview of the resource.

Zooming

Pressing the Ctrl and using the mouse wheel the IDE will increase/decrease font size in various windows creating a zoom effect. Zooming is also bound to Ctrl-+, Ctrl--, and Ctrl-0 reset the zoom to 100%.

Un-/commenting blocks

The editor has new commands for commenting and un-commenting a block of code with %-chars. The commands are bound to Ctrl-Alt-% and Ctrl-Alt-Shift-%. (It would be more correct to state the keys as Ctrl-Alt-5 and Ctrl-Alt-Shift-5, but it seems simpler to remember the %-key).

Project loading speed

The project loading has been changed such that the speed of this process was increased.

Find In Files dialog

The dialog Find In Files has been improved such that it now shows total number of found entries in a file as well.

Welcome Page

The Welcome Page has been improved such that now it has an extra context menu which can be accessed via right mouse. This menu allows to inspect project file properties, remove project from the list of projects, etc.

TODO Window

It is now possible to view all TODO comments (i.e. the comments like % TODO) in source files which can be rather convenient for developers. This feature is available via the Main menu: View | TODO

PFC

PFC has mainly been consolidated, updated to 64-bit numbers and things like that. But there are also some new things.

PIE

The engine of PIE (Prolog Interpreter Engine) is now added to PFC and will therefore be supported as a tool in future. The most important feature is that you can easily hook-in predicates from you own application. Subsequently, the PIE programs can manipulate your application. So PIE is very useful as a scripting engine in applications. Besides this, the efficiency has been improved and PIE now supports functions and real numbers.

progressBarControl

A progressBarControl binds to the win32 common control progress bar. It is the intension to add additional win32 common controls, but to deal more easily with them certain inner parts of PFC GUI will have to be revised first.

postAction

A new predicate postAction on the window class, makes it possible to post an action to any window. The action will be packed in a user message and when the user message is handled the action is executed. Together with anonymous predicates this makes any other use of user messages superfluous.

popupWindow

A new class popupWindow makes it easier to create popup windows like tooltips. Most importantly popup windows must have the screen as parent so that they can be drawn outside their logical owner and on top of other windows.

radixTree

A radix tree is a map from pointer to any type. Its main advantage (over for example red-black-trees) is that supports very efficient merge of several maps. The disadvantage is that the keys are pointer values, so the trees can only be used on things with unique pointers (like object and symbol).

uxTheme native bindings

Native bindings to uxTheme make it possible to experiment with creating theme aware controls. Theme aware controls are not drawn using lines, circles, rectangles, etc. Instead they are drawn using theme elements. Theme elements are logical graphical entities like divider line, button surface, button outline, drop-down mark, etc. You combine/draw such logical elements into your control, and when the theme changes your control will also change appearance. If you have chosen the elements wisely your control will also blend-in with other themes.

getFactChainLength_nd

A new predicate getFactChainLength_nd (in the profileMemory class) returns the number of facts in each class fact chain in the entire program. It is intended to help tracking down problems with class facts that are not retracted when they should and therefore eats memory by keeping data alive that should have been dead.

weakPointer

Weak pointers are "pointers" that the garbage collector does not see as pointers, so if there are only weak pointers to a piece of memory the garbage collector will recycle that piece of memory. As a consequence, a weak pointer cannot always be dereferenced, sometimes the target as been recycled. Dereferencing of a weak pointer it therefore done using a determ predicate.

So in short a weak pointer is a pointer that will not keep memory alive.

5xChainDB8

This package is introduced for compatibility support in order to handle old external databases (where strings are not in Unicode).

Tools

vipBuilder

Some extra options has been added to vipBuilder:

   /genresource - also generate resourceIdentifiers.i
   /compile <file_name> - compile the file <file_name>

coverageAnalysis

The coverage analysis gives information about the predicates that have been called during execution of the program. The coverage analysis program reads .deb files to get information about a set of classes and predicates in a program and coverage files to get information about the predicates that have been called during execution of the program. The program must be compiled with options /profile:min and /debug:full to use this new tool.

Updates

Build 7202

Visual Prolog 7.2, Build 7202 fixes a number of bugs the bugs fixed in the Build 7202.

The following new feature has been implemented in accordance with the user request in Visual Prolog Discussion Forum:

  • Add moving listener/responder to splitTwoControl

See also

Bugs Fixed in Visual Prolog 7.2

Bugs Fixed in Visual Prolog 7.2, Build 7201

Bugs Fixed in Visual Prolog 7.2. Build 7202

Visual Prolog 7.2 Upgrade Notes

Visual Prolog 7.2 Upgrade Notes