Page 1 of 1

Prolog - school project

Posted: 3 Jun 2020 23:03
by kim0
Hey guys,
I have to create Project about project. Project is going to be about modules and objects. Presentation really doesn't have to be complex - just what objects and modules are + simple code.

I know it's more professional forum, but I still need help. :-(
Talking about modules, I found this video, but I don't understand at all what happens there: https://www.youtube.com/watch?v=fG2HgTquAh4

All in all I ask you to tell me something about objects, modules and if it's possible simple codes to them.

Re: Prolog - school project

Posted: 4 Jun 2020 13:03
by Martin Meyer
Hi Kim,

very different Prolog implementations exist. Only some of them are modular within a framework of object-oriented programming.

Visual Prolog gives a fine example of objects and modules in a programming language. It comes with a programming environment for developing programs. The environment presents the files containing object types, modules, and else program parts in a tree.

There is a free version of Visual Prolog available for download. The Prolog language is identical in the free and commercial version, the free version is limited to build 32-bit applications only.

See the Hello World! demonstration. When you follow the steps shown in the video (the current Visual Prolog version differs very little), you get a -simple- program which contains objects and modules. Class main in file main.cl is for example a module, i.e. the class states no construction type. Interface time in file time.i, which you find in pfc ("Prolog Foundation Classes"), is an object type. The interface is not used in the main code of the "Hello World!" example, but the package of the time class is required by the surrounding code which calls the main code run predicate.

Comprehensive details of Visual Prolog's object model are covered by the Language Reference and in the Introduction to Classes and Objects tutorial. In the Language Reference you can also find example code of using objects.