Deprecated: Optional parameter $def_value declared before required parameter $type_value is implicitly treated as a required parameter in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/rtl.php on line 679

Deprecated: Return type of Runtime\CoreStruct::offsetExists($k) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/CoreStruct.php on line 120

Deprecated: Return type of Runtime\CoreStruct::offsetGet($k) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/CoreStruct.php on line 121

Deprecated: Return type of Runtime\CoreStruct::offsetSet($k, $v) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/CoreStruct.php on line 122

Deprecated: Return type of Runtime\CoreStruct::offsetUnset($k) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/CoreStruct.php on line 123

Deprecated: Return type of Runtime\_Map::offsetExists($k) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Dict.php on line 131

Deprecated: Return type of Runtime\_Map::offsetGet($k) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Dict.php on line 132

Deprecated: Return type of Runtime\_Map::offsetSet($k, $v) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Dict.php on line 133

Deprecated: Return type of Runtime\_Map::offsetUnset($k) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Dict.php on line 134

Deprecated: Return type of Runtime\_Map::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Dict.php on line 65

Deprecated: Return type of Runtime\_Collection::offsetExists($k) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Collection.php on line 91

Deprecated: Return type of Runtime\_Collection::offsetGet($k) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Collection.php on line 92

Deprecated: Return type of Runtime\_Collection::offsetSet($k, $v) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Collection.php on line 93

Deprecated: Return type of Runtime\_Collection::offsetUnset($k) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Collection.php on line 96

Deprecated: Return type of Runtime\_Collection::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Collection.php on line 47

Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Collection.php on line 522

Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Collection.php on line 522

Warning: http_response_code(): Cannot set response code - headers already sent (output started at /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/Collection.php:20) in /var/www/vhosts/bayrell.kz/www/bayrell.org/docs/lib/Runtime/php/loader.php on line 154
Неизменяемые структуры данных | Документация BAYRELL

Неизменяемые структуры данных

Описание структуры

namespace Test;

use Runtime.CoreStruct;

struct User extends CoreStruct
{
	string short_name = "";
	string full_name = "";
	string nick_name = "";
	string Collection emails = "";
}

Создание объекта

User user = new User
{
	"short_name": "John",
	"full_name": "John Smith",
	"nick_name": "Jey",
	"emails": [ "jey@example.com", "jey@localhost", ],
};

Изменения объекта

/* Будет пересоздан объект user, с новым свойством */
user <= short_name <= "John2";

/* Будет создан объект user2, с новыми свойствами */
User user2 = user.copy
{
	"full_name": "John Williams",
	"emails": user.pushIm("willy@example.com") 
}

Вложенные структуры

namespace Test;

use Runtime.CoreStruct;

struct Task extends CoreStruct
{
	string name = "";
	User user = null;
}

Создание объекта

Task task = new Task
{
	"name": "Task 1",
	"user": new User
	{
		"short_name": "John",
		"full_name": "John Smith",
		"nick_name": "Jey",
		"emails": [ "jey@example.com", "jey@localhost", ],
	}
};

Изменение вложенного объекта

/* Изменение имени, ответственного за задачу */
task <= user <= short_name <= "John2";