Zig Is Exciting

Zig is a newer language that is only on version 0.16.0. Despite it not being at version 1.x yet and therefore could have major breaking changes, there is a lot to get excited about with the current implementation of the language. It shows such promise that I’m learning it now and hope for it to become a regular member of my toolbox. Here’s what excites me about it:

Type System Sanity

I’m a very big fan of Programming Language Theory (PL Theory) and of course that means type-systems and how to encode guarantees into the types. Part of that is having the actual type system be sane and detailed enough that you can represent those requirements and prevent users (including yourself) from breaking those requirements. Zig has an advanced metaprogramming technique called comptime that I will discuss later. But part of why comptime works well is that the underlying system it builds on is sane.

[Read More]

Goodbye LLMs

I’ve been on PTO for the past two weeks to recharge and I am feeling energized to go back to work tomorrow. Part of this is getting the rest I’ve needed and spending time on my hobbies. But another part of this is the massive shift in public opinion on LLMs and their usefulness. I thought LLMs were a dead-end tech and not a path to true AGI (Artificial Generalized Intelligence - the holy grail of computer science) around 2023 or 2024, so seeing the entire industry be fully onboard with this tech has been very demoralizing. It has done nothing but take up space from real research that could be happening. I used to love reading Hacker News every day to expand my knowledge, but the majority of the content the past few years have just been “how you can better utilize LLMs”. So let’s start by talking about the problems with them.

[Read More]
Tags: AI LLMs code programming tech 

Things I Like About Nim

Method Call Syntax

In Nim, a.f(b) is really just syntactic sugar for f(a, b). Note: they look like methods but aren’t attached to the type/object at all. Which function to call will be figured out at compile time, just like normal function calls.

You can use this to implement pseudo extension methods on standard types like strings:

import
  nim_utils/files,
  os,
  strformat

proc makeBackup(filename: string) =
  let backupPath = fmt"{filename}.bak"
  case filename.fileType
  of ftFile, ftSymlink:
    copyFile(filename, backupPath)
  of ftDir:
    copyDir(filename, backupPath)
  else:
    raise newException(IOError, fmt"Cannot make backup of {filename}")


for f in @["fstab", "systemd"]:
    fmt"/etc/{f}".makeBackup() # Same as makeBackup(fmt"/etc/{f}")

You can also use this to chain calls together nicely:

[Read More]

S3 on Flashblade

I currently work for a company called Pure Storage. One of their products is called Flashblade. I couldn’t find any examples on how to use Flashblade’s S3 capabilities programmatically anywhere online, so I’m putting this out to hopefully help people realize they can move their object store into their data center with very little changes to their code.

Code Snippets

Most of the work with the libraries I’ve used involves figuring out how to get the client configured properly. Once that’s done, all of the methods work just like they do with Amazon S3.

[Read More]
Tags: tech programming code