Skip to content

Latest commit

 

History

History
106 lines (85 loc) · 4.37 KB

README.md

File metadata and controls

106 lines (85 loc) · 4.37 KB

korrosjon

Are you tired of writing Rust programs in English? Do you find yourself craving to shout out Norwegian expressions while coding? Looking for a new, exotic-sounding language that will bring some Scandinavian flair to your Rust projects?

korrosjon (Norwegian for Rust) is here to save your day, as it allows you to write Rust programs entirely in Norwegian, complete with Norwegian keywords, function names, and idioms.

Worried about being stuck with only Norwegian words, especially if you’re from a place where Norwegian isn’t the only lingua franca?

No worries! Norwegian Rust is fully compatible with English Rust, so you can mix both languages as you please.

Below is an example showcasing what is possible with korrosjon:

trait og impl (aka egenskap og implementasjon)

korrosjon::korrosjon! {
    ekstern eske korrosjon;

    bruk std::collections::Ordbok som Ordbok;

    egenskap Nøkkelverdi {
        funksjon skriv(&selv, nøkkel: Streng, verdi: Streng);
        funksjon les(&selv, nøkkel: Streng) -> Resultat<Kanskje<&Streng>, Streng>;
    }

    statisk foranderlig ORDBOK: Kanskje<Ordbok<Streng, Streng>> = Ingenting;

    struktur Konkret;

    implementer Nøkkelverdi for Konkret {
        funksjon skriv(&selv, nøkkel: Streng, verdi: Streng) {
            la ordbok = utrygt {
                ORDBOK.ta_eller_sett_inn_med(Standard::standard)
            };
            ordbok.sett_inn(nøkkel, verdi);
        }
        funksjon les(&selv, nøkkel: Streng) -> Resultat<Kanskje<&Streng>, Streng> {
            hvis la Noen(ordbok) = utrygt { ORDBOK.som_ref() } {
                Bra(ordbok.les(&nøkkel))
            } ellers {
                Prob("henting av ordbok".til())
            }
        }
    }
}

Other examples

See the examples to get a rough sense of the whole syntax. Det er ikke verre en det

Want to help?

First of all, tusen takk for considering participating to this completely serious project. Feel free to throw in a few identifiers here and there, and open a pull-request against the hoved (Norwegian for main) branch.

We would love support for Norwegian Nynorsk as an optional feature in the crate.

Other languages

license

WTFPL