primitive vs reference
You are here :

Sub nodes

Recent changes
Site plan
 
 

In Nosica, there is two semantics for constructing and manipulating objects.

Primitive objects

Primitive objects are small objects. Their semantic is passed by value. They are stack allocated. Most of net.nosica.lang objects are primitive objects. (int, float, string, ...)

To declare a primitive objects, you must use the 'primitive' keyword.

 primitive class int32 {
 }
 

Omitting the primitive keyword makes a reference object instead of a reference one.

A primitive object can

A primitive class does not have a root father class. A primitive class never uses polymorphism. All call are 'static'.

Reference objects

Reference objects are all the other object. Their semantic is passed by reference. They are heap allocated.

To declare a reference object, you must not use the 'primitive' keyword.

 class Object {
 }
 

A reference object can

By default, a reference object extends the net.nosica.lang.Object root object. A reference class always use polymorphism and even multi methods.

Propulsed by Wiclear