Programming language Chora: Instant properties

Instant properties provide a simple way to evaluate and modify operands of Chora own data types. One group of them allow a direct access to the elements of a data type. For example, you use the instant properties red, green, blue and alpha to access and modify the homonymous components of a color operand. Other instant properties, in turn, provide a convenient interface to perform more extensive operations on an operand. For example, the data type rect implements an instant property center, which calculates from the rectangle's current coordinates its center position. The rectangle itself doesn't store the center value.

Every instant property is strictly associated to the data type in context of which you can evaluate or modify it. For example, the instant property red can be used in context of a color operand but trying to evaluate red in context of a rect operand will report a Chora compiler error. Following instant properties are available:

Instant property name

Short description

abs

Represents the absolute value of the given int8, int16, int32, int64, float, point or rect operand.

alpha

Corresponds to the alpha component of a color operand.

area

Represents the area of a rectangle with size specified in a point or rect operand.

blue

Corresponds to the blue component of a color operand.

ceil

Represents the next highest integer value of a float operand.

center

Represents the position in the center of a rect operand.

floor

Represents the next lowest integer value of a float operand.

fract

Represents the fractional part of a float operand.

green

Corresponds to the green component of a color operand.

h

Represents the height of a rect operand.

isempty

Reflects the status of a rect, styles or user-defined set operand.

isinf

Verifies the Infinity (+INF or -INF) status of a float operand.

isinfn

Verifies the Negative Infinity (-INF) status of a float operand.

isinfp

Verifies the Positive Infinity (+INF) status of a float operand.

isnan

Verifies the Not a Number (NAN) status of a float operand.

length

Represents the number of characters within a string operand or the length of vector stored in a point operand.

lower

Represents the lower case version of a string or char operand.

orect

Represents a rect operand with its origin reset to <0,0>.

origin

Represents the origin position of a rect operand.

point1

Corresponds to the position of the top-left corner of a rect operand.

point2

Corresponds to the position of the bottom-right corner of a rect operand.

red

Corresponds to the red component of a color operand.

round

Represents the float operand rounded to the next lowest or highest integer value.

size

Represents the size of a rect operand or in case of an array as operand, determines its capacity.

trunc

Represents the float operand rounded by removing the fractional part.

uabs

Represents the absolute value of the given int8, int16, int32 or int64 operand.

upper

Represents the upper case version of a string or char operand.

w

Represents the width of a rect operand.

x

Corresponds to the x coordinate of a point or rect operand.

x1

Corresponds to the x coordinate of the top-left corner of a rect operand.

x2

Corresponds to the x coordinate of the bottom-right corner of a rect operand.

y

Corresponds to the y coordinate of a point or rect operand.

y1

Corresponds to the y coordinate of the top-left corner of a rect operand.

y2

Corresponds to the y coordinate of the bottom-right corner of a rect operand.