Scala 3 Macros: How to Read Annotations :: Jun 25, 2023
This post will examine how to read class & field StaticAnnotation
s from a Scala 3 Macro.
The 'Given Defaults Pattern': How to Implement Class Defaults with a Macro in Scala 3 :: Jun 23, 2023
The database client Magnum has Repositories, which derive common SQL statements like findById, insert, and update at compile-time.
Scala 3 Macros: Create Types with Arbitrary Values & Methods :: Jun 17, 2023
Sometimes you want to make types whose values & methods are determined programmatically, at compile time.
List vs Vector in 2022 :: Mar 15, 2022
It’s hard to choose between Scala’s List and Vector.
Scrap Your Boilerplate with Scala 3 Context Functions :: Feb 19, 2022
We program with contexts all the time. Some examples are Http request time, database transactions, or the ability to suspend a Coroutine.
C-style for loops in Scala 3 :: Sep 20, 2021
With Scala 3, we can easily implement fast C-style loops.
Braces in Scala 3 aren't just Optional, they're Consistent :: Sep 5, 2021
Scala 3 adds Optional Braces to the language. At first I was concerned the two different styles would cause confusion and ambiguity, but over time I’ve realized the new scheme actually makes the language more consistent.
Fast JSON in Scala 3 with Typeclass Derivation :: Feb 15, 2021
What is the fastest way to parse & serialize JSON in Scala? Could it be Circe, BooPickle, Play Json, or maybe uPickle?
What's the Fastest Way to Create JavaScript Types in Scala.js? :: Feb 10, 2020
In Scala.js, we cannot just write
Vendetta against Java Streams :: Jan 11, 2020
I like Java Streams as much as the next guy, but I can’t say that my experience using them has been all sunny. Here’s the long list of problems I’ve had with Streams during the last few years I’ve used them:
Fast Universal Hashing in Java :: Jan 11, 2020
Every Java Object has a hashCode
, but often many are required. This is Universal Hashing, and tools like Bloom Filters, Count-Min-Sketch, Minimal Perfect Hashing, and other probabilistic datastructures need it to be fast. Some people use a specially designed function like FNV or Murmur, but there is a cleaner (and faster) way with just Object::hashCode
.
Parallelism with Java Streams and CountedCompleter :: Dec 28, 2019
Parallel processing is an optimization. So if a problem demands parallelization, you should make sure the computational model is as performant as possible.
Build OpenJDK for a Nice Speedup :: Nov 2, 2019
Just-in-time compilation (JIT) is a beautiful thing, and Java leads the industry. But unlike C2, which compiles your class files with optimizations for a particular OS (mac), ISA (x86_64), and Architecture (Intel Broadwell), JVM distributions themselves are compiled only for OS and ISA. This enables portability while reducing the number of build combinations for vendors.
*Really* Small Java Apps :: Mar 4, 2019
Since bundling apps and runtime is the new best-practice (whether with Docker or jpackage), and the full JVM weighs in at hundreds of megabytes, how can we include only the minimal JVM subset our application requires? This post explores 4 complementary ways:
Scripting in Java :: Sep 28, 2017
Java is often ridiculed for its verbosity.
Removing scala.Predef for scala-library.jar Independence :: Aug 6, 2017
Completely removing scala.Predef can be enforced by the compiler with option -Yno-predef
. In addition to changing default type signatures and functions, removing Predef lets one become independent of Scala’s collections library. scalac
compiled .class
and .jar
files can then be directly executed with java
, without having to add the 5 megabyte scala-library.jar
to the classpath.
JVM Startup Times :: Jun 9, 2017
The JVM’s Achilles heel is long startup times. This is especially true for Scala programs, which require megabytes of additional jars on the classpath. On my 2015 i5 8gb ram Macbook Pro with Scala 2.12.2 and Java 8, the following takes over one second to execute:
Retroactive Polymorphism with Scala Typeclasses :: Jan 31, 2017
As an object-functional language, Scala supports many ways of writing generic, polymorphic code. This article will introduce retroactive polymorphism, and examine the advanced language features enabling it in Scala.
Phaeton CTF :: Jan 18, 2017
Around April 2016 I worked on a Halo 5 Forge map, set on the Parallax canvas. Originally the map was purely aestetic, but was later redesigned to support Phaeton-on-Phaeton CTF mayhem.
Giter8 Scala Templates :: Dec 2, 2016
Defending the configuration of my Scala templates.
Recommended scalac Options :: Dec 1, 2016
Threat Stack recently published a sound review of scala’s compiler flags. Here’s the archived links:
Creature Features :: Jul 24, 2016
A showcase of evolution’s diversity. Inspired by Mr. Traina’s Evolution, Biodiversity, and Ecology (EBE) class at the Illinois Math and Science Academy.
Pancreatic Cancer Research :: May 1, 2014
From May 2014 to August 2014, I researched Transforming Growth Factor Beta’s effect on epithelial-mesenchymal transition, which is implicated in the development of pancreatic adenocarcinoma. I worked under the guidance of Dr. Paul Grippo and Danny Principe of Northwestern University.