Kaleidoscope (programming language)

Last updated

The Kaleidoscope programming language is a constraint programming language embedding constraints into an imperative object-oriented language. It adds keywords always, once, and assert..during (formerly while..assert) to make statements about relational invariants. Objects have constraint constructors, which are not methods, to enforce the meanings of user-defined datatypes.

There are three versions of Kaleidoscope which show an evolution from declarative to an increasingly imperative style. Differences between them are as follows. [1]

Kaleidoscope'90Kaleidoscope'91Kaleidoscope'93
Constraint EvaluationLazyEagerEager
VariablesHold streamsHold streamsImperative
Concurrent ConstraintsStrictStrictNon-strict
SyntaxSmalltalk-likeAlgol-likeAlgol-like
Constraint ModelRefinementRefinementPerturbation
Method DispatchingSingleMultipleMultiple
AssignmentAs a constraintAs a constraintDestructive

Example

Compare the two code segments, both of which allow a user to drag the level of mercury in a simple graphical thermometer with the mouse.

Without constraints:

while mouse.button = down do  old <- mercury.top;  mercury.top <- mouse.location.y;  temperature <- mercury.height / scale;  display_number( temperature );  if old < mercury.top then   delta_grey( old, mercury.top );  elseif old > mercury.top then   delta_white( mercury.top, old );  end if; end while;

With constraints:

always: temperature = mercury.height / scale; always: white rectangle( thermometer ); always: grey rectangle( mercury ); always: display number( temperature ); while mouse.button = down do  mercury.top = mouse.location.y; end while;

Related Research Articles

In computer science, an abstract data type (ADT) is a mathematical model for data types, defined by its behavior (semantics) from the point of view of a user of the data, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations. This mathematical model contrasts with data structures, which are concrete representations of data, and are the point of view of an implementer, not a user. For example, a stack has push/pop operations that follow a Last-In-First-Out rule, and can be concretely implemented using either a list or an array. Another example is a set which stores values, without any particular order, and no repeated values. Values themselves are not retrieved from sets, rather one tests a value for membership to obtain a Boolean "in" or "not in".

<span class="mw-page-title-main">Thermometer</span> Device to measure temperature

A thermometer is a device that measures temperature or temperature gradient. A thermometer has two important elements: (1) a temperature sensor in which some change occurs with a change in temperature; and (2) some means of converting this change into a numerical value. Thermometers are widely used in technology and industry to monitor processes, in meteorology, in medicine, and in scientific research.

HyperTalk is a discontinued high-level, procedural programming language created in 1987 by Dan Winkler and used in conjunction with Apple Computer's HyperCard hypermedia program by Bill Atkinson. Because the main target audience of HyperTalk was beginning programmers, HyperTalk programmers were usually called "authors" and the process of writing programs was known as "scripting". HyperTalk scripts resembled written English and used a logical structure similar to that of the Pascal programming language.

<span class="mw-page-title-main">Scrollbar</span> Graphical user interface element

A scrollbar is an interaction technique or widget in which continuous text, pictures, or any other content can be scrolled in a predetermined direction on a computer display, window, or viewport so that all of the content can be viewed, even if only a fraction of the content can be seen on a device's screen at one time. It offers a solution to the problem of navigation to a known or unknown location within a two-dimensional information space. It was also known as a handle in the very first GUIs. They are present in a wide range of electronic devices including computers, graphing calculators, mobile phones, and portable media players. The user interacts with the scrollbar elements using some method of direct action, the scrollbar translates that action into scrolling commands, and the user receives feedback through a visual updating of both the scrollbar elements and the scrolled content.

Constraint programming (CP) is a paradigm for solving combinatorial problems that draws on a wide range of techniques from artificial intelligence, computer science, and operations research. In constraint programming, users declaratively state the constraints on the feasible solutions for a set of decision variables. Constraints differ from the common primitives of imperative programming languages in that they do not specify a step or sequence of steps to execute, but rather the properties of a solution to be found. In addition to constraints, users also need to specify a method to solve these constraints. This typically draws upon standard methods like chronological backtracking and constraint propagation, but may use customized code like a problem-specific branching heuristic.

In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow.

In computer science, human–computer interaction, and interaction design, direct manipulation is an approach to interfaces which involves continuous representation of objects of interest together with rapid, reversible, and incremental actions and feedback. As opposed to other interaction styles, for example, the command language, the intention of direct manipulation is to allow a user to manipulate objects presented to them, using actions that correspond at least loosely to manipulation of physical objects. An example of direct manipulation is resizing a graphical shape, such as a rectangle, by dragging its corners or edges with a mouse.

<span class="mw-page-title-main">Drag and drop</span> Action in computer graphic user interfaces

In computer graphical user interfaces, drag and drop is a pointing device gesture in which the user selects a virtual object by "grabbing" it and dragging it to a different location or onto another virtual object. In general, it can be used to invoke many kinds of actions, or create various types of associations between two abstract objects.

The Taskbar is a graphical user interface element that has been part of Microsoft Windows since Windows 95, displaying and facilitating switching between running programs. The Taskbar and the associated Start Menu were created and named in 1993 by Daniel Oran, a program manager at Microsoft who had previously collaborated on Great ape language research with the behavioral psychologist B.F. Skinner at Harvard.

<span class="mw-page-title-main">Graphical widget</span> Element of interaction in a graphical user interface

A graphical widget in a graphical user interface is an element of interaction, such as a button or a scroll bar. Controls are software components that a computer user interacts with through direct manipulation to read or edit information about an application. User interface libraries such as Windows Presentation Foundation, Qt, GTK, and Cocoa, contain a collection of controls and the logic to render these.

<span class="mw-page-title-main">Button (computing)</span> Graphical user interface element

In computing, a button is a graphical control element that provides the user a simple way to trigger an event, like searching for a query at a search engine, or to interact with dialog boxes, like confirming an action.

A menu bar is a graphical control element which contains drop-down menus.

The X Window System core protocol is the base protocol of the X Window System, which is a networked windowing system for bitmap displays used to build graphical user interfaces on Unix, Unix-like, and other operating systems. The X Window System is based on a client–server model: a single server controls the input/output hardware, such as the screen, the keyboard, and the mouse; all application programs act as clients, interacting with the user and with the other clients via the server. This interaction is regulated by the X Window System core protocol. Other protocols related to the X Window System exist, both built at the top of the X Window System core protocol or as separate protocols.

Alt+Tab ↹ is the common name for a keyboard shortcut that has been in Microsoft Windows since Windows 2.0 (1987). This shortcut switches between application-level windows without using the mouse; hence it was named Task Switcher.

A medical thermometer or clinical thermometer is a device used for measuring a human's or animal's body temperature. The tip of the thermometer is inserted into the mouth under the tongue, under the armpit, into the rectum via the anus, into the ear, or on the forehead.

In computing, reactive programming is a declarative programming paradigm concerned with data streams and the propagation of change. With this paradigm, it's possible to express static or dynamic data streams with ease, and also communicate that an inferred dependency within the associated execution model exists, which facilitates the automatic propagation of the changed data flow.

<span class="mw-page-title-main">Input device</span> Device that provides data and signals to a computer

In computing, an input device is a piece of equipment used to provide data and control signals to an information processing system, such as a computer or information appliance. Examples of input devices include keyboards, computer mice, scanners, cameras, joysticks, and microphones.

QML is a user interface markup language. It is a declarative language for designing user interface–centric applications. Inline JavaScript code handles imperative aspects. It is associated with Qt Quick, the UI creation kit originally developed by Nokia within the Qt framework. Qt Quick is used for mobile applications where touch input, fluid animations and user experience are crucial. QML is also used with Qt3D to describe a 3D scene and a "frame graph" rendering methodology. A QML document describes a hierarchical object tree. QML modules shipped with Qt include primitive graphical building blocks, modeling components, behavioral components, and more complex controls. These elements can be combined to build components ranging in complexity from simple buttons and sliders, to complete internet-enabled programs.

Impressive is a free and open-source software that displays presentation slides with 3D-effects. It is a lightweight and easy to use console presentation software with focus on PDF documents and images. It was started by Martin Fiedler in 2005.

References

  1. Lopez, Gus; Freeman-Benson, Bjorn; Borning, Alan (1993). "Kaleidoscope: A Constraint Imperative Programming Language" (PDF). constraints.cs.washington.edu. Retrieved 2023-12-30.