ObjectArt

ObjectArt is a (currently incomplete) esoteric programming language. It appears as a rectangular image, where each pixel represents one piece of code, determined by its RGB values. It is object-oriented, and based largely on Java.

This language is currently in development. Suggestions, especially about keyword colors, are welcome.

Design philosophy
ObjectArt is designed to be as human-readable as possible. Different types of keywords have very different colors, and all variables of the same type have the same shape.

Colors
There are 16,777,216 possible colors, as the Red, Green, and Blue components can each range from 0 to 255.

The color has a special function, see.

Colors where any of the Red, Green, or Blue components is equals to 128 represent keywords .The color is also a keyword.

Colors where the Red, Green, and Blue components are all less than 128 (the darkest octant) represent numbers.

Colors where the Red, Green, and Blue components are all greater than 128 (the brightest octant) represent Array inputs.

All other colors are used for variables.

Segments
An ObjectArt program consists of at least one segment, which serve as classes. To separate segments, a complete wall of "blank" space is used, so each orthogonally connected group of non-blank space is a segment. Segments (or groups of segments) can also be placed in a separate file. All files used must be placed in the same folder, and must be explicitly imported.

Classes
Each class is represented by a group of pixels in a specific shape. To define a class, put it into its own segment. Note that its shape will be somewhat determined by its methods. A class with a large number of methods must be quite intricate, but even a simple class can be as complicated as you want. That is, there is a lower bound on shape complexity for a class, but no upper bound.

There are no static classes. When running the program, it creates an instance of the specified class, and runs its main method. (If the file run has multiple segments, then the one with a main method is run. There may be no more than one main method per file.)

Program flow
The program starts with the class with the main method, which touches the class on exactly one side. The program continues out the other side, always going in a straight line. If it encounters the edge of the image, or the color, it turns right.

Keywords
Remember that all keyword colors have at least one component equal to 128 (#80). In general, bluish colors are used for math, greenish colors for control flow, and reddish colors for miscellaneous stuff.

Simple example
This is a simple way of defining a class which outputs "Hello, world" when run.

The dark yellow block in the upper left is the class definition. The red square (just one pixel in the original) to its right is the main method, run at execution time. Each purple square means "output the following character", the blue squares are the ASCII values for the characters. Note how the the program turns right at each wall, and at the gray square at the left. The program ends at the grayish square in the middle.

Bear in mind that the white space is never read by the program. All of the white squares (except a few near the class definition) can be changed to any color at all without problems, although using white helps for clarity, and is the standard convention.

Integers
The only literals (class-less types) are integers, which are equivalent to booleans and character values (using UTF-8).

Standard integers are represented as 16384R + 128G + B, using the two's complement system to represent negatives. The largest integer normally representable is thus 1048575, and the smallest is -1048576.

Other numbers
All numbers can exist in ObjectArt, including large numbers in both positive and negative, non-integers with unlimited precision, positive and negative infinity, and NaN. (Complex numbers may be added in a later version.) Many numbers not representable using the above method can be constructed in other ways. For example, 0.5 can be written as 1 / 2, negative infinity can be produced by -1 / 0, and 0 / 0 results in NaN.

However, there is no way to represent irrational numbers. Hence, any programming requiring a square-root function or Pi will have to make do with an approximation.

Boolean
Converting from numbers to Boolean, all numbers except 0 are considered true. From Boolean to numbers, true is -1 ; false is 0.

Classes
The essence of ObjectArt is classes. A program needs one class to run, but will typically make use of many other classes as well.

A class is defined as a shape. The shape can not be flipped or rotated. Typically, the main method's class is a three-by-three square, but any can be used. A class is defined by making its shape out of the color. Adjourning it must be an entry point and almost always a constructor. It will usually have methods, variables, and possibly a main method as well. Each of these components must touch the class on exactly one side.

To create an instance of a class, have the program flow lead into the entry point, draw the class (in any of the colors allocated for variables) and out the constructor. Then place any parameters, and finish with the done-with-parameters pixel. Voila! Your object is now created. To invoke it any time, go into the entry point of the object, and out one of the methods. Draw the parameters, and exit.