Skip to content

SrGesus/ferrugem

 
 

Repository files navigation

ferrugem

ferrugem

Aren't you cansado from writing Rust programs in English? Do you like saying "caralho" a lot? Would you like to try something different, in an exotic and funny-sounding language? Would you want to bring some Portuguese da terrinha touch to your programs?

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

You're from Açores (or elsewhere) and don't feel at ease using only Portuguese words?

Don't worry! Portuguese 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 ferrugem:

trait and impl (aka característica e implementa)

ferrugem::ferrugem! {
    externo contentor ferrugem;

    utiliza std::coleções::Dicionário como Dic;

    característica ChaveValor {
        função insere(&próprio, chave: Cadeia, valor: Cadeia);
        função obtem(&próprio, chave: Cadeia) -> Resultado<PodeSer<&Cadeia>, Cadeia>;
    }

    estático mutável DICIONÁRIO: PodeSer<Dic<Cadeia, Cadeia>> = Nenhum;

    estrutura Concreta;

    implementa ChaveValor para Concreta {
        função insere(&próprio, chave: Cadeia, valor: Cadeia) {
            seja dic = perigo {
                DICIONÁRIO.obtem_ou_insere_com(Predefinido::predefinido)
            };
            dic.insere(chave, valor);
        }
        função obtem(&próprio, chave: Cadeia) -> Resultado<PodeSer<&Cadeia>, Cadeia> {
            se seja Algum(dic) = perigo { DICIONÁRIO.como_ref() } {
                Bom(dic.obtem(&chave))
            } ou_então {
                Mau("mau maria que o gato já mia.".torna_em())
            }
        }
    }
}

Other examples

See the examples to get a rough sense of the whole syntax. E pronto, that's it.

but why would you do d- isto

The French have done it, why not?

a licença

WTFPL

About

Rust programming, in Portuguese.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%