/rez

Czech for the Rust programming language

Primary LanguageRustDo What The F*ck You Want To Public LicenseWTFPL

rez

rez Logo

Nejsi you tired from writing Rust programs in English? Do you like saying do prdele or pivo a lot? Would you like to try something different, in an exotic and funny-sounding language? Would you want to bring some Czech touch to your programs?

rez (Czech for Rust) is here to save your day, as it allows you to write Rust programs in Czech, using Czech keywords, Czech function names, Czech idioms.

This has been designed to be used as the official programming language to develop the future Czech sovereign operating system.

You don't feel at ease using only Czech words? Don't worry! Czech Rust is fully compatible with English Rust, so you can mix both at your convenience.

Here's an example of what can be achieved with rez:

vlastnost a implementuj (a.k.a. trait and impl)

rez::rez! {
    používej standardní_knihovna::kolekce::Slovník jako Slovník;

    vlastnost KlíčHodnota {
        funkce vlož(&já, klíč: Řetězec, hodnota: Řetězec);
        funkce čti(&já, klíč: Řetězec) -> Výsledek<Možná<&Řetězec>, Řetězec>;
    }

    statický měnitelný SLOVNÍK: Možná<Slovník<Řetězec, Řetězec>> = Nic;

    // Slib mi, že toto nikdy nepoužiješ mimo hlavní vlákno!
    struktura GlobálníSlovník;

    implementuj KlíčHodnota pro GlobálníSlovník {
        funkce vlož(&já, klíč: Řetězec, hodnota: Řetězec) {
            ať slovník = nebezpečné {
                SLOVNÍK.dostaň_nebo_vlož_s(Výchozí::výchozí)
            };

            slovník.vlož(klíč, hodnota);
        }

        funkce čti(&já, klíč: Řetězec) -> Výsledek<Možná<&Řetězec>, Řetězec> {
            jestli je Nějaký(slovník) = nebezpečné { SLOVNÍK.jako_odkaz() } {
                VPořádku(slovník.dostaň(&klíč))
            } jinak {
                Špatné("Ověření slovníku".konvertuj())
            }
        }
    }
}

Alternative syntax

#[povol(nedosažitelný_kód)]
funkce když_se_nepodaří() {
    panika!("Panika!");
    ups!("Něco se pokazilo");
}

Other examples

See the examples to get a rough sense of the whole syntax. It's that snadné.

Přispívání

First of all, moc děkuju for considering participating to this joke, the Czech government will thank you later! Feel free to throw in a few identifiers here and there, and open a pull-request against the hlavni (Czech for main) branch.

In the Czech spirit, feel free to introduce swear words.

But proč would you do this?

  • The glorious czech language can't fall behind the other languages
  • Pro zábavu

Other languages

Here's a non-exhaustive list of implementations for other languages:

You can find a more comprehensive list on @bnjbvr's rouille repo.

Poděkování

  • @bnjbvr for the idea, as well as the base repo
  • @aionescu for the exposure to this idea and inspiring me to do this

Licence

WTFPL