Patina by Example
Patina is a statically typed programming language for the BEAM virtual machine, focusing on type safety and easy interop with broader Elixir ecosystem. Its syntax, type semantics, and much of its compiler code, is directly derived from Rust.
Patina by Example is a collection of examples that illustrate various Patina concepts. It is a fork of the excellent Rust By Example (RBE), with many parts unchanged - where Patina and Rust syntax match exactly.
Now let’s begin!
-
Hello World - Start with a traditional Hello World program.
-
Primitives - Learn about signed integers, unsigned integers and other primitives.
-
Custom Types -
structandenum. -
Variable Bindings - mutable bindings, scope, shadowing.
-
Types - Learn about changing and defining types.
-
Conversion - Convert between different types, such as strings, integers, and floats.
-
Expressions - Learn about Expressions & how to use them.
-
Flow of Control -
if/else,for, and others. -
Functions - Learn about Methods, Closures and Higher Order Functions.
-
Modules - Organize code using modules.
-
Packages - Organize modules into distributable packages.
-
Attributes - An attribute is metadata applied to some module or item.
-
Generics - Learn about writing a function or data type which can work for multiple types of arguments.
-
Traits - A trait is a collection of methods defined for an unknown type:
Self -
Macros - Macros are a way of writing code that writes other code, which is known as metaprogramming.
-
Error handling - Learn Patina way of handling failures.
-
Unsafe Operations - Learn about entering a block of unsafe operations.