Jump to content

Realbasic

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Graham87 (talk | contribs) at 12:26, 28 July 2011 (1 revision from nost:REALbasic: import old edit). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Realbasic (RB) is the object-oriented dialect of the BASIC programming language used in Real Studio, a programming environment, developed and commercially marketed by Real Software, Inc of Austin, Texas for Mac OS X, Microsoft Windows, 32-bit x86 Linux and the web.

Language features

RB is a strongly typed language with minimal automatic type conversion, which supports single inheritance and interfaces, class methods and class properties, automatic memory management via reference counting, and operator overloading. A very important feature is the ability to extend (not just inherit from) existing classes, like Objective-C Categories. This considerably reduces the need for the Abstract Factory Pattern, which complicates using Application Frameworks in Java and C++. Realbasic also includes delegates, introspection, and namespace support, which allows modules to contain classes, interfaces and other modules.

Framework features

As described in the language reference, its built-in framework supports (Real Software 2008):

The framework functionality can also be extended by creating plugins using the Plugin SDK provided by Real Software. Plugins are created using C/C++ with a variety of supported compilers, including Xcode, Microsoft Visual Studio and gcc. Plugins can support any platform Realbasic supports, but are not required to support all platforms.

Example code

This is an example of operator overloading for a hypothetical Complex class which permits to sum a real to a complex number, and to sum two complex numbers:

Function Operator_Add (rhs As Single) As Complex
  Dim ret As New Complex
  ret.Real = Self.Real + rhs
  ret.Imaginary = Self.Imaginary
  Return ret
End Function

Function Operator_Add (rhs As Complex) As Complex
  Dim ret As New Complex
  ret.Real = Self.Real + rhs.Real
  ret.Imaginary = Self.Imaginary + rhs.Imaginary
  Return ret
End Function

The same function can be defined to accept Double datatype values. This code shows how to use the Complex class to sum a real with a complex number:

 Dim First As New Complex (0, 1)
 Dim Second As New Complex (1, 1)
 Dim Sum As Complex
 Sum = First + 5.0 + Second
 // Sum will be (6, 2)

See also

Comparable Basic Dialects

Other Programming Languages

References

  • Smith, Tony (September 13, 2005). "RealBasic 2005 for Mac, Windows and Linux". The Register. Retrieved 2006-04-11.
  • Barr, Joe (August 4, 2005). "Review: RealBasic 2005 for Linux". Linux.com. Retrieved 2006-04-11.
  • Real Software (May 6, 2008). "Realbasic Language Reference". Real Software. Retrieved 2008-05-06.
  • Tejkowski, Erick (2001). REALbasic for Dummies. Hungry Minds. ISBN 0-7645-0793-1.