Visual Prolog 10 Upgrade Notes

From wiki.visual-prolog.com

Revision as of 11:51, 5 January 2024 by Thomas Linder Puls (talk | contribs) (superfluous files)

This document describes how to upgrade Visual Prolog 9 projects to Visual Prolog 10, for older projects you should also read the Visual Prolog 9 Upgrade Notes.

If you have problems with upgrading your projects and need additional information, you are welcome to ask questions in Visual Prolog Discussion Forum.

By default, the installation of Visual Prolog 10 will not replace any previously installed versions. It is possible to work with several versions on a single computer.

  • The Commercial Edition will by default be installed in C:\Program Files (x86)\Visual Prolog 10 or C:\Program Files\Visual Prolog 10.
  • The Personal Edition will by default be installed to C:\Program Files (x86)\Visual Prolog 10PE or C:\Program Files\Visual Prolog 10PE.

Visual Prolog 10 projects are backward-compatible with Visual Prolog 9 projects. If you are going to use different versions of Visual Prolog installed at one computer, avoid opening projects by double-clicking on vipprj files.

Notice it is highly advisable to have a backup of a project before updating.

Superfluos files

The following files are superfluous and should be deleted:

  • .frm related to forms
  • .win related to e.g. the task window
  • .ctrl related to a control
  • .dlg related to dialogs; except if it corresponds to "aincient" Visual Prolog 5 resource dialog that has been "inherited" into the project. If in doubt: the code in the corresponding .pro file of such a dialog will not contain a generatedInitialize predicate.

Binary memory representation

Binaries have changed representation. In the old representation a binary was a pointer to the actual data, and immediately before the data the size of the binary was written. Windows API and other external APIs does not use this representation and as a consequence binaries was often had to be copied from the buffer that cntains it to another "buffer" that can hold the size infront of the data. A binary is now represented as a pointer to a memory cell containing a pointer to a data-buffer and the size. So the size is no longer placed in a specific place relative to the actual data. With the old representation uncheckedConvert of a binary to the pointer domain would result in a pointer to the data. With the new representation this is no longer the case and therefore it has been made illegal to uncheckedConvert from binary to pointer, instead you must use convert which will both in old and new representation give a pointer to the data. Alternatively, you can use the extension predicate binary::data() instead, e.g. Pointer = MyBinary:date().

List comprehension

In a list comprehension [ Exp || Gen ] the Exp must be a procedure (language reference has always required that, but the compiler has accepted determ expressions). In cases where Exp is determ the following rewrite can be applied [ V || Gen, V = Exp ].

<>_list domains deprecated

The domains integer_list, integer_list_list, etc. has been deprecated. In declarations the *-form should be used, but in predicate calls like tryToTerm it is necessary to uses the list{...} type constructor, e.g. tryToTerm(list{integer}, String). An old program can require a significant amount of updates.

Erroneous predicates as values

erroneous predicates can now be used as a value, for example in X otherwise raise_error(). Hereby erroneous functions have become superfluous, and subsequently it is now illegal to declare erroneous functions (a corresponding erroneous predicate must be used instead).

See also