<commit_before># Todo

## Critical Bugs
* Ensure 'Array.pop-back' is memory safe and shrinks the array properly.
* Can't define globals of with heap allocated types (String, structs, etc.)
* A program using references to arrays but nothing else produces invalid typedefs (see sum-functions for adding the elements of an array)
* Compiling a self recursing function (of type (λ [] ()) at least) hangs the compiler.

## Ugliness
* Just entering '=' at the REPL leads to strange type error.
* The 'range' function is fully generic (for all 'a') but only compiles when 'a' is numeric type
* Remove unnecessary Array-functions and rewrite them in Carp?
* Create a proper .c file for the core library C functions. Or at least rename the prelude.h file to core.h
* No need to set unique identifiers on XObj:s in Parse.hs?

## Big Language Features
* Allow evaluation of dynamic functions in the REPL and give access to the Commands from dynamic code
* Platform defines and optional compilation
* Generic data types (apart from Array, which already is)
* Tagged unions (also known as "sum types" or "enums")
* Lambdas (anonymous functions)
* Doc strings

## Smaller Language Features ("niceties")
* Enable interop with existing C structs. Proposed syntax: "(register-type my_position_struct [x Int, y Int])"
* All the math functions! (getting there...)
* Good string functions
* Being able to use 'the' in function parameter declarations, i.e. (defn f [(the Int x)] x) to enforce a type
* Allow use of 'the' as a wrapper when defining a variable or function, i.e. (the (Fn [Int] Int) (defn [x] x))
* Quasiquote
* Splicing in macros
* Pattern matching on arguments in macros?
* Some lists and similar things generated by built in dynamic functions like 'cons' etc don't create proper Info for their XObjs
* A way to assert compiler errors in tests
* Load paths for (load ...) command

## Language Design Considerations
* What's the correct type of the variable in a set!-form, i.e. (set! &x value) or (set! x value)
* Is some kind of interface/typeclass construct worthwhile?
* How should passing primitive types (that do not care about being referenced) as ref:ed parameters be handled?
* How to handle heap allocated values? Box type with reference count?
* Fixed-size stack allocated arrays would be useful (also as members of structs)
* Look over how many times the function 'annotateOne' in Infer.hs actually needs to be applied to a form
* Macros in modules must be qualified right now, is that a good long-term solution?
* Should macros calling non-macros/non-dynamicfunctions just fail instead of returning an unvealuated list which is pretty confusing?
* Make @ work for all types, not just the 'use':d ones

## Code generation
* LLVM backend
* Emit #LINE macros in the generated C code

## Tooling
* Warning when changing the type of a function (can create bugs by overriding earlier declarations with the same name)
* Enable printing of typed AST:s at the REPL to help debug unresolved type variables etc.
* Proper error handling when defining invalid struct types (right now it crashes)
* Stop evalutaion of forms after errors to avoid "Trying to refer to undefined symbol" error
* Preserve whitespace to allow saving forms back to disk<commit_msg>Math done.<commit_after># Todo

## Critical Bugs
* Ensure 'Array.pop-back' is memory safe and shrinks the array properly.
* Can't define globals of with heap allocated types (String, structs, etc.)
* A program using references to arrays but nothing else produces invalid typedefs (see sum-functions for adding the elements of an array)
* Compiling a self recursing function (of type (λ [] ()) at least) hangs the compiler.

## Ugliness
* Just entering '=' at the REPL leads to strange type error.
* The 'range' function is fully generic (for all 'a') but only compiles when 'a' is numeric type
* Remove unnecessary Array-functions and rewrite them in Carp?
* Create a proper .c file for the core library C functions. Or at least rename the prelude.h file to core.h
* No need to set unique identifiers on XObj:s in Parse.hs?

## Big Language Features
* Allow evaluation of dynamic functions in the REPL and give access to the Commands from dynamic code
* Platform defines and optional compilation
* Generic data types (apart from Array, which already is)
* Tagged unions (also known as "sum types" or "enums")
* Lambdas (anonymous functions)
* Doc strings

## Smaller Language Features ("niceties")
* Enable interop with existing C structs. Proposed syntax: "(register-type my_position_struct [x Int, y Int])"
* Good string functions
* Being able to use 'the' in function parameter declarations, i.e. (defn f [(the Int x)] x) to enforce a type
* Allow use of 'the' as a wrapper when defining a variable or function, i.e. (the (Fn [Int] Int) (defn [x] x))
* Quasiquote
* Splicing in macros
* Pattern matching on arguments in macros?
* Some lists and similar things generated by built in dynamic functions like 'cons' etc don't create proper Info for their XObjs
* A way to assert compiler errors in tests
* Load paths for (load ...) command

## Language Design Considerations
* What's the correct type of the variable in a set!-form, i.e. (set! &x value) or (set! x value)
* Is some kind of interface/typeclass construct worthwhile?
* How should passing primitive types (that do not care about being referenced) as ref:ed parameters be handled?
* How to handle heap allocated values? Box type with reference count?
* Fixed-size stack allocated arrays would be useful (also as members of structs)
* Look over how many times the function 'annotateOne' in Infer.hs actually needs to be applied to a form
* Macros in modules must be qualified right now, is that a good long-term solution?
* Should macros calling non-macros/non-dynamicfunctions just fail instead of returning an unvealuated list which is pretty confusing?
* Make @ work for all types, not just the 'use':d ones

## Code generation
* LLVM backend
* Emit #LINE macros in the generated C code

## Tooling
* Warning when changing the type of a function (can create bugs by overriding earlier declarations with the same name)
* Enable printing of typed AST:s at the REPL to help debug unresolved type variables etc.
* Proper error handling when defining invalid struct types (right now it crashes)
* Stop evalutaion of forms after errors to avoid "Trying to refer to undefined symbol" error
* Preserve whitespace to allow saving forms back to disk
{'fraction_non_alphanumeric': 0.06662534862101023, 'fraction_numerical': 0.0, 'mean_word_length': 4.502983802216539, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1114447', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1650, 'n_words': 982}