Aren't you mệt mỏi from writing Rust programs in English? Do you like saying "đù" a lot? Would you like to try something different, in an exotic and funny-sounding language? Would you want to bring some Vietnamese touch to your programs?
gỉ (Vietnamese for Rust) is here to save your day, as it allows you to write Rust programs in Vietnamese, using Vietnamese keywords, Vietnamese function names, Vietnamese idioms.
You're not from Vietnam mainland and don't feel at ease using only Vietnamese words? Don't worry! Vietnamese 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 Gỉ:
gỉ::gỉ! {
dùng chuẩn::tập_hợp::ÁnhXạBăm như ÁnhXạ;
tính_chất KhoáGiáTrị {
hàm viết(&bản_thân, khoá: Xâu, giá_trị: Xâu);
hàm đọc(&bản_thân, giá_trị: Xâu) -> Tuỳ<&Xâu>;
}
tĩnh khả_biến TỪ_ĐIỂN: Tuỳ<ÁnhXạ<Xâu, Xâu>> = Rỗng;
cấu_trúc CụThể;
triển_khai KhoáGiáTrị với CụThể {
hàm viết(&bản_thân, khoá: Xâu, giá_trị: Xâu) {
đặt tđ = nguy_hiểm {
TỪ_ĐIỂN.đọc_hoặc_chèn_với(MặcĐịnh::mặc_định)
};
tđ.chèn(khoá, giá_trị);
}
hàm đọc(&bản_thân, khoá: Xâu) -> KếtQuả<Tuỳ<&Xâu>, Xâu> {
nếu đặt Có(tđ) = nguy_hiểm { TỪ_ĐIỂN.bằng_tham_chiếu() } {
Được(tđ.đọc(&khoá))
} không_thì {
InLỗi("đang lấy tđ (từ điển)".vào())
}
}
}
}
#[cho_phép(mã_không_được_chạy)]
hàm thứ_cấp() {
đù!("ôi không");
trời_đất!("lỗi rồi");
ối!("sai ở đây");
}
Additionally, you can put tone diacritics the old way (Tùy
) or the current
standard way (Tuỳ
)
See the examples to get a rough sense of the whole syntax.
First of all, cám ơn nhiều for considering participating to this joke, the
Vietnamese government will thank you later! Feel free to throw in a few
identifiers here and there, and open a pull-request against the chính
(Vietnamese for main
) branch.
- horsin around
- playing with raw proc macros
- making a bit of fun about programming languages that do this seriously, though I can see their utility.
- others can do it so why not
See the original shitpost for a more up-to-date list.
- @dinhanhx for making a logo!
Giấy phép Công cộng Thích làm gì thì làm, the unofficial translation of the WTFPL by the me.