DEV Community

JA Proger
JA Proger

Posted on • Edited on

StaLang Lesson No 2 Storages

THIS LESSON IS ACTIVELY BEING WRITTEN

Contents

Intro

The quote for all concepts in StaLang, especially for this lesson

My language โ€” My rules
JA Proger, 2025

Storage definition

Storage? What's the hell STORAGE concept in programming?
Frankly speaking, it's my idea ๐Ÿ˜ˆ to unify many keywords which are wonderfully can be included to this definition โ€” Storage.

Basic storages

Basic storages in StaLang are

  • Data data
  • Constant const
  • List list
  • Matrix matrix
  • Alias alias

Why so?
I just like this. Recall the quote in the Intro section ๐Ÿ˜ˆ. Well, all of them designed for the purpose of the StaLang.
Let's dive into details.

Data

What is data?
Data is a storage which can brings anything: values, structures instances, functions.

Consider the following example:

type Bulb {
   ON,
   OFF
}
data five = 5;
data bulb: Bulb = ::ON;
Enter fullscreen mode Exit fullscreen mode

Comparison with other languages:

Language Variable keyword
StaLang data
Swift var
Rust let mut
Go var
Python nothing ๐Ÿ˜‚
TypeScript const
Lua local

Const

List

Alias

Alias is a storage which stores your custom alias for existed keyword.
There are several requirements to aliases:

  1. Alias must be a valid ID
alias 0g = out; // You cannot do this. It will raise an error
Enter fullscreen mode Exit fullscreen mode
  1. Alias cannot be an existed keyword.
alias type = out; // You cannot do this. It will raise an error
Enter fullscreen mode Exit fullscreen mode

Valid example:

alias sexwith = out;
sexwith "girl"; // prints "girl"
Enter fullscreen mode Exit fullscreen mode

ID

Links

Ask any questions in the comments below!

Top comments (0)