Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Learning Jai via Advent of Code (forrestthewoods.com)
14 points by _hao on Feb 15, 2023 | hide | past | favorite | 2 comments


Has features similar to zig comptime. String macros and structured macros plus reflection and AST. Manual memory with fine-grained control of allocators, pointers. A few categories of interesting directives.

Semantic

  #complete          exhaustive enum check
  #must              return value must be used
  #specified         enum values must be explicit
  #symmetric         2-arg function can be called either way
  #type              next statement is a type
Optimize

  #asm               inline assembly
  #bake_arguments    bake argument into function
  #bytes             inline binary data
  #no_abc            disable array bounds checking
  #no_padding        specify no struct padding
  #place             specify struct member location
Meta

  #code              statement is code
  #compiler          interfaces with compiler internals
  #compile_time      compile-time true/false
  #expand            function is a macro
  #insert            inject code
  #intrinsic         function handled by compiler
  #placeholder       symbol will be generated at compile-time
  #procedure_name    acquire comp-time procedure name
  #run               execute at compile-time
  #type              next statement is a type
Clean syntax. Reasonable modules. A build system. No mention of package management though. Didn't cover "using" and data oriented programming much.

Overall looks like a reasonable competitor for systems or game programming.


“No mention of package management though. Didn’t cover data oriented programming much.”

Mr. Blow has a whole host of videos about the language and tooling on his youtube page. Many of them are multiple hours in length. The SOA/AOS ones discuss the data oriented aspect a bit and there is a video titled I think “Libraries Discussion” or something similar on the topic of package management. As i understand it: no centralised package repository, and dependencies are expected to be vendored and built with the rest of one’s project.

Edit to Add: The further back one goes in the youtube channel, the less the talk addresses the language as it currently exists vs how it existed then (as time has a tendency to do).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: