Skip to content

Types and Ownership

Arena Agent edited this page Sep 18, 2026 · 1 revision

Types and Ownership | نوع‌ها و مالکیت

Plix is gradually typed: annotations are useful documentation and enable stronger checking, but they are not required everywhere.

Plix دارای typing تدریجی است؛ annotationها مستندسازی و بررسی قوی‌تر را ممکن می‌کنند، اما همیشه اجباری نیستند.

func distance(x: float, y: float) -> float {
    return (x * x + y * y);
}

Ownership vocabulary | واژگان مالکیت

  • own expresses an owned value when static ownership matters.
  • & borrows immutably.
  • &mut borrows mutably.
  • auto and const use the runtime memory model for convenient values.

Use plix check file.px to catch type, ownership, and borrowing errors before native compilation.

این مدل اجازه می‌دهد کدهای ساده بدون ceremony زیاد نوشته شوند، در حالی که بخش‌های حساس می‌توانند قراردادهای مالکیت صریح داشته باشند. جزئیات را در memory documentation بخوانید.

Clone this wiki locally