- Fix parse_list_expr to skip newlines between list elements - Add `pub` keyword to all exported functions in stdlib/html.lux - Change List.foldl to List.fold (matching built-in name) - Update weaknesses document with fixed issues The module import system now works correctly. This enables: - import stdlib/html to work as expected - html.div(), html.render() etc. to be accessible - Multi-line list expressions in Lux source files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.9 KiB
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:
- Parser didn't skip newlines inside list expressions, causing parse errors in multi-line lists
- Functions in stdlib modules weren't marked as
pub(public), so they weren't exported
Fix:
- Added
skip_newlines()calls toparse_list_expr()in parser.rs - Added
pubkeyword 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 '<main>': 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): Unitwrite(path: String, content: String): Unitcopy(src: String, dst: String): UnitreadDir(path: String): List<String>
8. No Template String Support
Description: Multi-line strings and template literals (like JavaScript's backticks) would make HTML generation much easier.
Current Approach:
let html = "<div class=\"" + className + "\">" + content + "</div>"
Better Approach (not available):
let html = `<div class="${className}">${content}</div>`
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:
- String concatenation - Works with
+operator - Conditional expressions -
if/then/elseworks - Console output -
Console.print()works - Basic types -
String,Int,Boolwork - Let bindings - Variable assignment works
- Functions - Function definitions work
- Module imports - Works with
import stdlib/module - Html module - Fully functional for generating HTML strings
Recommendations
For Website MVP
The module system now works! The website can be:
- Generated from Lux using the html module for HTML rendering
- CSS separate file (already done in
static/style.css) - Lux code examples embedded as text in HTML
For Future
- Add FileSystem effect for writing generated HTML to files
- Markdown-based documentation parsed and rendered by Lux
- 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 |