Osy#the first language built for agents
Agents firstAgentic appsWorkflowsDurable Execution — built inSecurityTestingThe editorThe UI modelOne program

Reference

Class

14 pages.

Classes

A class is an in-memory shape — data plus the behaviour that belongs to it — and it never touches the database. That is the whole distinction from an…

Class inheritance

A class can derive from another class with `class Circle : Shape`, inheriting its fields and its methods to any depth. A value of the derived type…

Comparing classes

`==` on two class values compares them BY VALUE, field by field, rather than by reference. A class is a value you build rather than a row you hold…

Copying a class with changes

`with` makes a COPY of a class value and replaces the fields you name. Everything you do not name comes from the value you copied, and the original…

Generic classes

A class can declare type parameters, so one shape serves every type it is used with instead of being copied per entity. The type argument is written…

Method overloads

A class can declare several methods with the same name, as long as they differ in their parameter types. Each call picks the one that fits its…

Sequence fields on a class

A class can hold many values in one field — `string[]`, `int[]`, `List<Tag>`, `HashSet<string>`, `Dictionary<string, int>`. The element may be a…

Testing which class a value is

`s is Circle` asks which type a value actually is at run time, answering by the value's own type rather than the type it is declared as. A derived…

`params` parameters

`params` lets a method be called with any number of trailing arguments — `Total(1m, 2m, 3m)` — which arrive as one array. It must be the last…

`readonly` fields

A `readonly` field can be assigned only where it is declared or in a constructor of the class that declares it. Everywhere else — a method of the…

`static` methods

A `static` method belongs to the type rather than to any instance, and is called on the type name — `Money.Round(x)`. It has no `this`, so it cannot…

class methods

Behaviour attached to a class — a method with a receiver, called as value.Method(). Classes are in-memory values, so a method is the natural place…

class properties

A class member that reads and writes like a field but runs a body on access — a computed value, a validating setter, or an auto-property whose…

constructor

A class declares one constructor — its name is the class name, it takes no return type, and it runs when you write new T(args). The constructor body…