Tutorial by Topics: opt



Optional is a container object which may or may not contain a non-null value. If a value is present, isPresent() will return true and get() will return the value.

Additional methods that depend on the presence of the contained value are provided, such as orElse(), which returns a default value if value not present, and ifPresent() which executes a block of code if the value is present.

“ An optional value either contains a value or contains nil to indicate that a value is missing”

Excerpt From: Apple Inc. “The Swift Programming Language (Swift 3.1 Edition).” iBooks. https://itun.es/us/k5SW7.l

Basic optional use cases include: for a constant (let), use of an optional within a loop (if-let), safely unwrapping an optional value within a method (guard-let), and as part of switch loops (case-let), defaulting to a value if nil, using the coalesce operator (??)

The Option<T> type is Rust's equivalent of nullable types, without all the issues that come with it. The majority of C-like languages allow any variable to be null if there is no data present, but the Option type is inspired by functional languages which favour 'optionals' (e.g. Haskell's Maybe monad). Using Option types will allow you to express the idea that data may or may not be there (since Rust doesn't have nullable types).
The x86 family has been around for a long time, and as such there are many tricks and techniques that have been discovered and developed that are public knowledge - or maybe not so public. Most of these tricks take advantage of the fact that many instructions effectively do the same thing - but different versions are quicker, or save memory, or don't affect the Flags. Herein are a number of tricks that have been discovered. Each have their Pros and Cons, so should be listed.

Page 1 of 4