9 posts tagged with "design-choices"

View All Tags

Making samlang Run in Browsers

Background

samlang is my favorite and most sophisticated side project. It is a functional programming language with an optimizing compiler that targets the X86 instruction set and a language server that can provide type query and autocompletion.

The compiler and the language server was written in Kotlin and compiled to JVM bytecode. It's worth noting that Kotlin has multiplatform support and can compile any Kotlin code into JVM bytecode and JavaScript with a single codebase. Therefore, it's theoretically possible to create a samlang build that can run in browsers.

The reality is always harsher than the theory. It takes a significant effort of refactoring to make this happen. In this blog post, I will explain these efforts and some of the tricky design decisions I made along the way.

How to Implement Autocomplete

Implement autocomplete in 79 lines of code. Actually, it's not that easy.

Without the infrastructure discussed in this post, that code snippet mentioned here is useless.

I will walk through my journey to implement autocomplete in this blog post, using my programming language SAMLANG as an example.

Move Fast with Automation Powered Monorepo

In the last article The Road to Better Engineering, I promised that there will be a new post about my recent website re-architecturing effort. In the past week, I am working to gradually transform the website monorepo into a repository with latest technologies and reliable automation. At the time of writing this article, the transformation is complete and the repository has reached a state that I am mostly satisfied with.

The Road to Better Engineering

The Start

About three years ago, a student club welcomes the largest influx of new members in its entire existence. It is considered as a milestone: it’s a de facto recognition that it’s becoming prominent. By that time, its product covers over 40% of the student base and the club is the place for future software engineers to go. The former president of the club publicly celebrated this, and he was thinking about how the club can continue to move fast without any overhead of bureaucracy.

If you have read my blog post before, you know what had happened. Beneath the promising sign of future prosperity, there were huge risks: the main product already hit the upper bound of the user count; the engineering team was not well-trained by the former president; more importantly, the codebase was in a hell state.

That club is called Computerization and that dumb former president was me.

Design Choice of SAMLANG in Alpha

Background

In the last summer, I developed my first programming language SAMPL. Measured against my technical skills at that time, it was a clear success. I was able to implement an interpreter and a compiler for a self-designed functional programming language with only the knowledge to implement an interpreter for a toy language in Cornell CS 3110. I was particularly proud of the module system and generics in that language.

A Year of Change - Reflection on My Website's Architecture Update

Background

I bought the domain developersam.com in February 2015 and officially started my own website. Before that, I hosted my website on the free tk domain, but I decided to remove that kind of sketchiness when I received my first scholarship. The website is poorly maintained, received no update for almost a year since it's published. After I was admitted to Cornell in December 2016, I started to update my website more often, but still not as frequent as I would do right now. In a quite slow progress, the website finally got to an acceptable shape at the end of July last year.

Function Reference in SAMPL - A Design Mistake and the Fix

Background

In most functional programming languages, a function IS a value. Therefore, it can be easily passed as a parameter for a function. For example, this is legal in OCaml:

let f (i: int): float = float_of_int i
let test (f: 'a -> 'b) (a: 'a) : 'b = f a
let ( * ) = test f 3

Even for Javascript, this can be done easily:

function f(s) {
return parseInt(s);
}
function test(f, a) {
return f(a);
}
const ignoreMe = test(f, '3');

Design Choice of SAMPL - Written After the First Alpha Release

Beginning

Starting from May 21, after I finished the algo final at Cornell, I started to develop my own programming language SAMPL. I decide to design a new language for a while, because I was frustrated by the ugliness of OCaml's namespace but miss its nice functional features. The exact name of the language was not chosen with much deliberation: I just want the name to contain a substring SAM.

Project DEFCON 1: A Confidential Data Storage System

1.Introduction

This short article is devoted to describe a data storage system that ensures data confidentiality even if you are interrogated under torture. I personally call the system Project DEFCON 1.

The system, with an option to switch on and off, lies behind the usual login feature as a second-step authenticator. Since it dramatically increased the complexity of login process, it is recommended to switch it on only when you feel imminent threat, as suggested by the name 'DEFCON 1'.