Strictly Typed Functional Programming for Roblox

I managed to get Hypatia, an Elm and PureScript like typed Functional Programming language that compiles to Lua, running in Roblox. Roblox is a 3D game engine that has a ton of already built games and editor where games are built in Lua. My kids spend way too much time and our money in it. I couldn’t get Amulet, another similar language, too compile, but Hypatia “spoke to me” more. Advent of Code 2020 this year taught me dealing with no types and race conditions is painful. I really wanted to explore what other language options there are that compile to Lua.

Continue reading “Strictly Typed Functional Programming for Roblox”

Five Levels of Error Handling in Both Python and JavaScript

Introduction

I spoke at OpenSlava 2020 a few weeks back, specifically around the levels of error handling you should apply to coding. However, I wanted a written article to refer to for those who don’t want to watch the video.

The below covers the 5 levels of error handling. I call them “levels” because the idea is to start with the lowest level, learn how it works, and then level up to the next. The ideal is that you utilize level 5 error handling, pattern matching, in all types of coding you do regardless of language. If you’re operating at that level, you’ll have more predictable code. There are other types of error handling, these are just the most common I’ve seen.

The error handling skill tree is as follows:

🏎 lvl 1: ignore ’em, dynamic languages have fast iteration
⚾️ lvl 2: try/catch/throw
🏭 lvl 3: Go/Lua style, function return values, pass back up
⛓ lvl 4: pipeline style, like JavaScript Promise
🌯 lvl 5: pattern match on returned types

Continue reading “Five Levels of Error Handling in Both Python and JavaScript”