rost/README.md

78 lines
2.6 KiB
Markdown
Raw Permalink Normal View History

2021-09-11 18:21:47 +02:00
# rost
2021-09-09 19:40:29 +02:00
2021-09-11 18:21:47 +02:00
<p align="center"><img src="logo.jpg" alt="Rust German Logo"></p>
2021-09-11 18:26:33 +02:00
Aren't you _müde_ from writing Rust programs in English? Do you like saying
2021-09-11 18:21:47 +02:00
"scheiße" a lot? Would you like to try something different, in an exotic and
funny-sounding language? Would you want to bring some German touch to your
2021-09-09 20:04:10 +02:00
programs?
2021-09-09 19:40:29 +02:00
2021-09-11 18:21:47 +02:00
**rost** (German for _Rust_) is here to save your day, as it allows you to
write Rust programs in German, using German keywords, German function names,
German idioms.
2021-09-09 19:40:29 +02:00
2021-09-11 18:21:47 +02:00
You're don't feel at ease using only German words? Don't worry!
German Rust is fully compatible with English-Rust, so you can mix both at your
2021-09-09 20:04:10 +02:00
convenience.
2021-09-11 18:21:47 +02:00
Here's an example of what can be achieved with Rost:
2021-09-09 20:04:10 +02:00
2021-09-11 18:21:47 +02:00
## struct and impl (aka Konvention und Umsetzung)
2021-09-11 15:59:40 +02:00
2021-09-09 20:04:10 +02:00
```rust
2021-09-11 18:21:47 +02:00
rost::rost! {
benutze std::collections::Wörterbuch als Wöbu;
2021-09-09 20:04:10 +02:00
eigenschaft SchlüsselWert {
funktion schreibe(&selbst, schlsl: Zeichenkette, wert: Zeichenkette);
funktion lese(&selbst, schlsl: Zeichenkette) -> Ergebnis<Möglichkeit<&Zeichenkette>, Zeichenkette>;
2021-09-09 20:04:10 +02:00
}
2021-09-11 15:55:13 +02:00
statisch änd WÖRTERBUCH: Möglichkeit<Wöbu<Zeichenkette, Zeichenkette>> = Nichts;
2021-09-11 15:55:13 +02:00
struktur Konkret;
2021-09-11 15:55:13 +02:00
umstz SchlüsselWert für Konkret {
funktion schreibe(&selbst, schlsl: Zeichenkette, wert: Zeichenkette) {
lass wöbu = gefährlich {
WÖRTERBUCH.hole_oder_füge_ein_mit(Standard::standard)
2021-09-11 15:55:13 +02:00
};
wöbu.einfügen(schlsl, wert);
2021-09-11 15:55:13 +02:00
}
funktion lese(&selbst, schlsl: Zeichenkette) -> Ergebnis<Möglichkeit<&Zeichenkette>, Zeichenkette> {
wenn lass Etwas(wöbu) = gefährlich { WÖRTERBUCH.als_ref() } {
Gut(wöbu.hole(&schlsl))
} anderenfalls {
Fehler("Holt das Wörterbuch".hinein())
2021-09-11 15:55:13 +02:00
}
}
2021-09-09 20:04:10 +02:00
}
}
```
2021-09-11 18:21:47 +02:00
## Other examples
2021-09-11 15:59:40 +02:00
2021-09-09 20:04:10 +02:00
See the [examples](./examples/src/main.rs) to get a rough sense of the whole
2021-09-11 18:21:47 +02:00
syntax. Gut so!
2021-09-09 19:40:29 +02:00
2021-09-11 18:21:47 +02:00
## but why would you do dis?
2021-09-09 20:04:10 +02:00
2021-09-11 19:22:48 +02:00
* the [French](https://github.com/bnjbvr/rouille) and [Dutch](https://github.com/jeroenhd/roest) can do it, so we can as well!
2021-09-09 19:40:29 +02:00
2021-09-11 18:21:47 +02:00
## Mitwirken
2021-09-09 19:40:29 +02:00
2021-09-11 18:21:47 +02:00
First of all, _vielen Dank_ for considering participating to this joke, the
German government will thank you later! Feel free to throw in a few identifiers
here and there, and open a pull-request against the `hauptzweig` (German for
`main`) branch. The initial translation was made by [Shemnei](https://github.com/Shemnei/) and [michidk](https://github.com/michidk/).
2021-09-11 18:21:47 +02:00
## Die Lizenzbestimmungen
2021-09-09 19:40:29 +02:00
[WTFPL](http://www.wtfpl.net/).
2021-09-11 18:21:47 +02:00
Image attributions:
* "Brezel und Filzhut zum Oktoberfest" by Tim Reckmann | a59.de is licensed under CC BY 2.0
* "Lederhose" is licensed under CC BY-NC-SA 4.0