Smart Pascal

Last updated

Smart Pascal is an Object Pascal programming language that is derived from Delphi Web Script and is adapted for Smart Mobile Studio for generating commercial JavaScript machine code. As a rapid application development (RAD) language, it contains a library of classes and components. The Smart Pascal compiler is a source-to-source compiler generating server-independent applications which are compliant with HTML5. Compiled Smart applications can be executed in a modern HTML5-capable browser. A compiled program is then typically embedded within a DIV container element or alternatively set to occupy the entire display.

Contents

History

Smart Mobile Studio, designed by Jon Lennart Aasenden and Eric Grange, is published by software company Optimale Systemer. It uses Delphi Web Script, an open-source scripting engine, for syntax verification and parsing. On 18 May 2012, Optimale Systemer disclosed that it had acquired the rights to a custom code generator written by Eric Grange, the maintainer of Delphi Web Script, from his company, Creative IT. Eric Grange introduced anonymous classes in Smart Pascal starting from version 1.0.

Prototype

The first prototype was released on 20 December 2011. The project received full two-page coverage in Blaise Pascal Magazine. The run-time library grew to include support for Remobjects SDK and Embarcadero Datasnap. From version 2.0, Smart Pascal also supported NodeJS, Web Workers and the Espruino microcontroller platform.

Linguistic differences

Property expressions

In Object Pascal, a property is an exposed value that can either be linked to a class-field or a class-member method. The consumer does not know if the property is explicitly linked to a field or a writer method. Smart Pascal introduces a technique called "property expressions". It allows the user to program reader and writer logic as a part of property declarations.

The Smart Pascal IDE built object-oriented, modular applications designed to live in an HTML document. Separate windows can be populated with controls, and code events can be connected to these to respond to user activity. Smart Mobile Studio does come with a visual form designer and property editor. The Smart Pascal run-time library has full support for creating CSS3 styles, "tweening", display redraw synchronization, GPU-powered 2D and 3D sprites and WebGL.

Database access

The engines WebSQL, IndexedDB and WebStorage API are supported.[ as of? ] The Smart IDE also allows access to Embarcadero DataSnap, which is a remote-data-access framework. Using these import libraries allows Smart Pascal applications to read, write and update remote datasets. Smart Pascal is itself written in Embarcadero Delphi. The run-time library includes classes for RemObjects SDK, a remote procedure call framework along the lines of Microsoft RPC. JSON RPC and WebSockets are likewise part of the class library.

Array operations were added to the Smart Pascal syntax to better adapt to JavaScript. Smart Pascal has a built-in for all arrays, as long as the datatypes match.

Anonymous classes

In traditional Object Pascal, all classes inherit from a root type called TObject. This was also the case for Delphi Web Script. To import JavaScript classes, the dependency on TObject as the root of all class types needed to be modified. This allows the user to define a class as external, and classes written in JavaScript that match the interface can thus be created and used alongside those written in Pascal. Anonymous classes can also be used as lightweight objects.

Limited support

The anonymous method was introduced in Smart Pascal as a means to improve compatibility with JavaScript. Under native Pascal, users have class procedures and ordinary procedures. The only difference between these two is that if the user wants to reference a class method, they must append "of object" to its declaration. The compiler does not allow you to reference an object method without "of object" being clearly defined.

Partial classes are yet a feature that has not made it into the Object Pascal standard. Smart Pascal supports two declaration formats of partial classes. The RemObjects Oxygene Pascal syntax and also the "type mytype = partial class(ancestor type)" variation.

In Pascal, a set is a collection of elements of the same type. The Smart Pascal syntax currently supports only sets of enumerations with the "in" operator and "include(aSet, aValue)" or "exclude(aSet, aValue)" methods. Smart Pascal does not support generics. The original syntax of Delphi Web Script Smart Pascal derives from was compatible with Delphi 7. Run-time type information is inpart supported by DWScript, including the ability to enumerate properties and class members. RTTI is implemented by the Smart Pascal JavaScript compiler if the "Emit RTTI information" is defined in the Project's Compiler options.

Sources

External references

Related Research Articles

Pascal is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named after French mathematician, philosopher and physicist Blaise Pascal.

In computing, cross-platform software is computer software that is designed to work in several computing platforms. Some cross-platform software requires a separate build for each platform, but some can be directly run on any platform without special preparation, being written in an interpreted language or compiled to portable bytecode for which the interpreters or run-time packages are common or standard components of all supported platforms.

C++Builder is a rapid application development (RAD) environment for developing software in the C++ programming language. Originally developed by Borland, as of 2009 it is owned by Embarcadero Technologies, a subsidiary of Idera. C++Builder can compile apps for Windows, iOS, macOS, and Android. It includes tools that allow drag-and-drop visual development, making programming easier by incorporating a WYSIWYG graphical user interface builder.

The Visual Component Library (VCL) is a visual component-based object-oriented framework for developing the user interface of Microsoft Windows applications. It is written in Object Pascal.

In computer science, reflective programming or reflection is the ability of a process to examine, introspect, and modify its own structure and behavior.

<span class="mw-page-title-main">Delphi (software)</span> General-purpose programming language and a software product

Delphi is a general-purpose programming language and a software product that uses the Delphi dialect of the Object Pascal programming language and provides an integrated development environment (IDE) for rapid application development of desktop, mobile, web, and console software, currently developed and maintained by Embarcadero Technologies.

In computing, type introspection is the ability of a program to examine the type or properties of an object at runtime. Some programming languages possess this capability.

In computer programming, run-time type information or run-time type identification (RTTI) is a feature of some programming languages that exposes information about an object's data type at runtime. Run-time type information may be available for all types or only to types that explicitly have it. Run-time type information is a specialization of a more general concept called type introspection.

Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.

<span class="mw-page-title-main">Free Pascal</span> Free compiler and IDE for Pascal and ObjectPascal

Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, with exception clauses that allow static linking against its runtime libraries and packages for any purpose in combination with any other software license.

A user interface markup language is a markup language that renders and describes graphical user interfaces and controls. Many of these markup languages are dialects of XML and are dependent upon a pre-existing scripting language engine, usually a JavaScript engine, for rendering of controls and extra scriptability.

<span class="mw-page-title-main">Oxygene (programming language)</span> Object Pascal-based programming language

Oxygene is a programming language developed by RemObjects Software for Microsoft's Common Language Infrastructure, the Java Platform and Cocoa. Oxygene is based on Delphi's Object Pascal, but also has influences from C#, Eiffel, Java, F# and other languages.

In Microsoft Windows applications programming, OLE Automation is an inter-process communication mechanism created by Microsoft. It is based on a subset of Component Object Model (COM) that was intended for use by scripting languages – originally Visual Basic – but now is used by several languages on Windows. All automation objects are required to implement the IDispatch interface. It provides an infrastructure whereby applications called automation controllers can access and manipulate shared automation objects that are exported by other applications. It supersedes Dynamic Data Exchange (DDE), an older mechanism for applications to control one another. As with DDE, in OLE Automation the automation controller is the "client" and the application exporting the automation objects is the "server".

A property, in some object-oriented programming languages, is a special sort of class member, intermediate in functionality between a field and a method. The syntax for reading and writing of properties is like for fields, but property reads and writes are (usually) translated to 'getter' and 'setter' method calls. The field-like syntax is easier to read and write than many method calls, yet the interposition of method calls "under the hood" allows for data validation, active updating, or implementation of what may be called "read-only fields".

Morfik Technology Pty Ltd. is an Australian software company that was acquired by Altium in 2010.

RemObjects Software is an American software company founded in 2002 by Alessandro Federici and Marc Hoffman. It develops and offers tools and libraries for software developers on a variety of development platforms, including Embarcadero Delphi, Microsoft .NET, Mono, and Apple's Xcode.

Dart is a programming language designed by Lars Bak and Kasper Lund and developed by Google. It can be used to develop web and mobile apps as well as server and desktop applications.

Windows Runtime (WinRT) is a platform-agnostic component and application architecture first introduced in Windows 8 and Windows Server 2012 in 2012. It is implemented in C++ and officially supports development in C++, Rust/WinRT, Python/WinRT, JavaScript-TypeScript, and the managed code languages C# and Visual Basic (.NET) (VB.NET).

This page details the history of the programming language and software product Delphi.