exploring typecheking sql query in typed/racket

This post will describe a POC on how to typecheck sql query in typed/racket.


The goal is to make this typecheck:

(: some-query : (Listof (Vector String String)))
(define some-query
  (query
   movies
   #:from     ([actor a] [movie m])
   #:where    (= a.name "Jhon Wayne")
   #:select   (a.name m.name)))

With the schema defined as:

(define-schema movies
  (actor    [id Integer]
            [name String])
  (movie    [id Integer]
            [name String]
            [director_id Integer])
  (director [id Integer]
            [name String]))

transpile php to javascript

Some ideas on how to build a php to javascript transpiler


I spend a good part of my work time in front of php or javascript code, so I wonder what will it be to compile php to javascript (in a browser context only). All of this is not tested it is just out of my head, I should have looked up how other have come up with problems like yield but this would kill all interest.

Mapping data from sql result to struct

This post describe the implementation of a descriptive macro to fill structures from sql result.


The goal

At end of this post we will archive this:

;; assume the table actor exist and have at least id, name, age

(struct actor ([id #:auto] [name #:auto] [age #:auto]) 
  #:transparent #:mutable #:auto-value #f)

(select
    (["id" actor id]
     ["name" actor name]
     ["age" actor age])
  "SELECT a.* FROM actor AS a where a.id = $1"
  12)
;; => '(((actor 12 "some name" 80)))

basic fastcgi with racket

The objective is to implement the most basic working fastcgi protocol in pure racket.


How it works

The minimal fastcgi implementation will look like:

  1. wait on a tcp connection
  2. read all input data
  3. write output hello world like data
  4. close connection