We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
RailsConf 2023 - Functional Patterns in Ruby by John Crepezzi
Explore the functional patterns in Ruby and OCaml, including type systems, object-oriented vs functional paradigms, monads, pattern matching, functors, and more, and discover how OCaml's powerful type system and syntax can improve your coding experience.
- Types systems: Ruby’s is dynamic, OCaml’s is static, making it more cumbersome to write code without explicitly handling all possible cases.
- Object-oriented vs functional paradigms: Ruby favors object-oriented approaches, while OCaml is more functional.
- Monads: ocaml has a built-in option monad that handles null in a safer way, and also other monads like the validator monad.
- Pattern matching: OCaml’s pattern matching is powerful and can be used to handle many cases at once, making it a powerful tool.
- Functors: OCaml’s functors are a way to create and manipulate modules, allowing for modular and reusable code.
- Type inference: OCaml’s type inference engine makes it possible to infer types without explicitly defining them.
- OCaml’s powerful type system: OCaml’s type system is designed to catch errors at compile-time, making it a safer language.
- OCaml’s vs Ruby’s syntax: OCaml’s syntax is more concise and expressive, but Ruby’s is more familiar to developers who have learned it.
- Interaction with OCaml tools: the OCaml compiler and IDE can help catch errors and improve code quality.
-
Case statement: in OCaml, case statements can be used to handle pattern matching and can be made more explicit with the
when
keyword. - option monad: in OCaml, the option monad can be used to handle null in a safer way, and also other monads like the validator monad.
- OCaml’s powerful type system: OCaml’s type system is designed to catch errors at compile-time, making it a safer language.
- Development culture: OCaml’s development culture encourages modularity and reusability, and developers are encouraged to share their code and learn from others.
- Learning resources: OCaml has many resources and documentation, but some of the advanced concepts may be difficult for beginners.