# Lux Weaknesses Discovered During Website Development This document tracks issues and limitations discovered while building the Lux website in Lux. ## Fixed Issues ### 1. Module Import System Not Working (FIXED) **Description:** The `import` statement wasn't working for importing standard library modules. **Root Cause:** Two issues were found: 1. Parser didn't skip newlines inside list expressions, causing parse errors in multi-line lists 2. Functions in stdlib modules weren't marked as `pub` (public), so they weren't exported **Fix:** 1. Added `skip_newlines()` calls to `parse_list_expr()` in parser.rs 2. Added `pub` keyword to all exported functions in stdlib/html.lux **Status:** FIXED --- ### 2. Parse Error in html.lux (FIXED) **Description:** When trying to load files that import the html module, there was a parse error at line 196-197. **Error Message:** ``` Module error: Module error in '
': Parse error: Parse error at 196-197: Unexpected token: \n ``` **Root Cause:** The parser's `parse_list_expr()` function didn't handle newlines between list elements. **Fix:** Added `skip_newlines()` calls after `[`, after each element, and after commas in list expressions. **Status:** FIXED --- ### 3. List.foldl Renamed to List.fold (FIXED) **Description:** The html.lux file used `List.foldl` but the built-in List module exports `List.fold`. **Fix:** Changed `List.foldl` to `List.fold` in stdlib/html.lux. **Status:** FIXED --- ## Minor Issues ### 4. String.replace Verified Working **Description:** The `escapeHtml` function in html.lux uses `String.replace`. **Status:** VERIFIED WORKING - String.replace is implemented in the interpreter. --- ### 5. FileSystem Effect Not Fully Implemented **Description:** For static site generation, we need `FileSystem.mkdir`, `FileSystem.write`, `FileSystem.copy` operations. These may not be fully implemented. **Workaround:** Use Bash commands via scripts. **Status:** Needs verification --- ### 6. List.concat Verified Working **Description:** The `List.concat` function is used in html.lux document generation. **Status:** VERIFIED WORKING - List.concat is implemented in the interpreter. --- ## Feature Gaps ### 7. No Built-in Static Site Generation **Description:** There's no built-in way to generate static HTML files from Lux. A static site generator effect or module would be helpful. **Recommendation:** Add a `FileSystem` effect with: - `mkdir(path: String): Unit` - `write(path: String, content: String): Unit` - `copy(src: String, dst: String): Unit` - `readDir(path: String): List` --- ### 8. No Template String Support **Description:** Multi-line strings and template literals (like JavaScript's backticks) would make HTML generation much easier. **Current Approach:** ```lux let html = "
" + content + "
" ``` **Better Approach (not available):** ```lux let html = `
${content}
` ``` **Status:** Feature request --- ### 9. No Markdown Parser **Description:** A built-in Markdown parser would be valuable for documentation sites. **Status:** Feature request --- ## Working Features These features work correctly and can be used for website generation: 1. **String concatenation** - Works with `+` operator 2. **Conditional expressions** - `if/then/else` works 3. **Console output** - `Console.print()` works 4. **Basic types** - `String`, `Int`, `Bool` work 5. **Let bindings** - Variable assignment works 6. **Functions** - Function definitions work 7. **Module imports** - Works with `import stdlib/module` 8. **Html module** - Fully functional for generating HTML strings --- ## Recommendations ### For Website MVP The module system now works! The website can be: 1. **Generated from Lux** using the html module for HTML rendering 2. **CSS separate file** (already done in `static/style.css`) 3. **Lux code examples** embedded as text in HTML ### For Future 1. **Add FileSystem effect** for writing generated HTML to files 2. **Markdown-based documentation** parsed and rendered by Lux 3. **Live playground** using WASM compilation --- ## Test Results | Feature | Status | Notes | |---------|--------|-------| | String concatenation | Works | `"<" + tag + ">"` | | Conditionals | Works | `if x then y else z` | | Console.print | Works | Basic output | | Module imports | Works | `import stdlib/html` | | Html module | Works | Full HTML generation | | List.fold | Works | Fold over lists | | List.concat | Works | Concatenate list of lists | | String.replace | Works | String replacement | | FileSystem | Unknown | Not tested | --- ## Date Log | Date | Finding | |------|---------| | 2026-02-16 | Module import system not working, parse error at line 196-197 in html.lux | | 2026-02-16 | Fixed: Parser newline handling in list expressions | | 2026-02-16 | Fixed: Added `pub` to stdlib/html.lux exports | | 2026-02-16 | Fixed: Changed List.foldl to List.fold |