{"id":40874580,"url":"https://github.com/rufflang/ruff","last_synced_at":"2026-01-25T04:00:54.248Z","repository":{"id":292633549,"uuid":"981452017","full_name":"rufflang/ruff","owner":"rufflang","description":"Ruff is a lean, expressive language built to help you think clearly and build confidently.","archived":false,"fork":false,"pushed_at":"2026-01-22T11:47:58.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-22T12:38:26.487Z","etag":null,"topics":["programming-language","ruff","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rufflang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-11T06:13:54.000Z","updated_at":"2026-01-22T11:48:01.000Z","dependencies_parsed_at":"2025-05-11T08:30:14.094Z","dependency_job_id":null,"html_url":"https://github.com/rufflang/ruff","commit_stats":null,"previous_names":["rufflang/ruff"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/rufflang/ruff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufflang%2Fruff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufflang%2Fruff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufflang%2Fruff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufflang%2Fruff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rufflang","download_url":"https://codeload.github.com/rufflang/ruff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufflang%2Fruff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28742983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T02:46:29.005Z","status":"ssl_error","status_checked_at":"2026-01-25T02:44:29.968Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["programming-language","ruff","rust"],"created_at":"2026-01-22T01:00:51.692Z","updated_at":"2026-01-25T04:00:54.241Z","avatar_url":"https://github.com/rufflang.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐾 Ruff Programming Language\n\n**Ruff** is a lean, expressive programming language built from scratch in Rust. It borrows inspiration from Go, Python, and functional design — but stands on its own.\n\n\u003e **Status**: v0.6.0 (Released January 2026) - Production-ready databases (SQLite, PostgreSQL, MySQL), HTTP authentication (JWT, OAuth2), streaming, connection pooling, transactions, and serialization (JSON, TOML, YAML, CSV). Built with comprehensive features including structs, methods, closures, collections, type checking, modules, concurrency, and image processing.\n\n**Quick Links**: [Installation](#installation) • [Getting Started](#getting-started) • [REPL](#interactive-repl-v050-) • [Examples](#writing-ruff-scripts) • [Features](#project-status) • [Changelog](CHANGELOG.md) • [Roadmap](ROADMAP.md)\n\n---\n\n## Project Status\n\n### Implemented Features (v0.6.0)\n\n* **Interactive REPL** (v0.5.0)\n  - Full-featured Read-Eval-Print Loop\n  - Multi-line input with automatic detection\n  - Command history with up/down arrow navigation\n  - Line editing with cursor movement\n  - Special commands: `:help`, `:quit`, `:clear`, `:vars`, `:reset`\n  - Pretty-printed colored output\n  - Persistent state across inputs\n  - Error handling without crashes\n  - Launch with: `ruff repl`\n\n* **Variables \u0026 Constants**\n  - `let` and `mut` for mutable variables\n  - `const` for constants\n  - Shorthand assignment with `:=` (e.g., `x := 5`)\n  - Optional type annotations: `x: int := 5`\n  - **NEW**: `:=` now properly updates existing variables across scopes\n\n* **Lexical Scoping** (v0.3.0)\n  - Proper scope chain with environment stack\n  - Variables update correctly across scope boundaries\n  - Accumulator pattern works: `sum := sum + n` in loops\n  - Function local variables properly isolated\n  - Nested functions can read and modify outer variables\n  - For-loop variables don't leak to outer scope\n  - Variable shadowing with `let` keyword\n\n* **Functions**\n  - Function definitions with `func` keyword\n  - Parameter passing with optional type annotations\n  - Return values with optional return type annotations\n  - Lexical scoping with access to outer variables\n  - Functions as first-class values\n  - Nested function definitions\n  - **NEW**: Closures with variable capturing (v0.6.0)\n    - Functions capture their definition environment\n    - Closure state persists across calls\n    - Support for counter patterns and partial application\n    ```ruff\n    func make_counter() {\n        let count := 0\n        return func() {\n            count := count + 1\n            return count\n        }\n    }\n    ```\n\n* **Control Flow**\n  - `if`/`else` statements\n  - Pattern matching with `match`/`case`\n  - `loop` and `for` loops\n  - **NEW**: `while` loops (v0.3.0)\n  - **NEW**: `break` and `continue` statements (v0.3.0)\n  - For-in iteration over arrays, dicts, strings, and ranges\n  - `try`/`except`/`throw` error handling\n  - **NEW**: Enhanced error handling (v0.4.0) with error properties, custom error types, and stack traces\n\n* **Data Types**\n  - Numbers (f64)\n  - Strings with escape sequences\n  - **NEW**: String interpolation with `${}` (v0.3.0): `\"Hello, ${name}!\"`\n  - Booleans: `true`, `false` (v0.3.0)\n  - **NEW**: Null values: `null` (v0.6.0) - for optional chaining and default values\n  - Enums with tagged variants\n  - Arrays: `[1, 2, 3]`\n  - Dictionaries: `{\"key\": value}`\n  - Structs with fields and methods\n  - Functions as first-class values\n\n* **Collections** (v0.2.0)\n  - Array literals and nested arrays\n  - Dictionary (hash map) literals\n  - Index access: `arr[0]`, `dict[\"key\"]`\n  - Element assignment: `arr[0] := 10`, `dict[\"key\"] := value`\n  - For-in iteration: `for item in array { }`, `for key in dict { }`\n  - Built-in methods: `push()`, `pop()`, `slice()`, `concat()`, `keys()`, `values()`, `has_key()`, `remove()`\n  - `len()` function for strings, arrays, and dicts\n  - **NEW**: Advanced Collections (v0.6.0)\n    - **Set**: Unique value collections with union, intersection, difference operations\n      ```ruff\n      users := Set([\"alice\", \"bob\", \"alice\"])  # {\"alice\", \"bob\"}\n      users := set_add(users, \"charlie\")\n      has_bob := set_has(users, \"bob\")  # true\n      ```\n    - **Queue**: FIFO (First-In-First-Out) data structure for task processing\n      ```ruff\n      tasks := Queue([])\n      tasks := queue_enqueue(tasks, \"task1\")\n      result := queue_dequeue(tasks)  # [modified_queue, \"task1\"]\n      ```\n    - **Stack**: LIFO (Last-In-First-Out) data structure for undo/history\n      ```ruff\n      history := Stack([])\n      history := stack_push(history, \"page1\")\n      result := stack_pop(history)  # [modified_stack, \"page1\"]\n      ```\n\n* **Array Higher-Order Functions** (v0.3.0)\n  - Functional programming operations for data transformation\n  - `map(array, func)`: Transform each element\n    ```ruff\n    squared := map([1, 2, 3], func(x) { return x * x })  # [1, 4, 9]\n    ```\n  - `filter(array, func)`: Select elements matching condition\n    ```ruff\n    evens := filter([1, 2, 3, 4], func(x) { return x % 2 == 0 })  # [2, 4]\n    ```\n  - `reduce(array, initial, func)`: Accumulate into single value\n    ```ruff\n    sum := reduce([1, 2, 3, 4], 0, func(acc, x) { return acc + x })  # 10\n    ```\n  - `find(array, func)`: Get first matching element\n    ```ruff\n    found := find([10, 20, 30], func(x) { return x \u003e 15 })  # 20\n    ```\n  - Chainable for complex data processing\n  - Anonymous function expressions: `func(x) { return x * 2 }`\n\n* **Structs \u0026 Methods** (v0.2.0)\n  - Struct definitions with typed fields\n  - Struct instantiation: `Point { x: 3.0, y: 4.0 }`\n  - Field access: `point.x`\n  - Method calls: `rect.area()`, `point.distance()`\n  - **Self parameter** (v0.5.0): Explicit `self` for method composition\n    ```ruff\n    struct Calculator {\n        base: float,\n        \n        func add(self, x) {\n            return self.base + x;\n        }\n        \n        func chain(self, x) {\n            return self.add(x) * 2.0;  # Call other methods\n        }\n    }\n    \n    calc := Calculator { base: 10.0 };\n    result := calc.chain(5.0);  # 30.0\n    ```\n  - Builder patterns and fluent interfaces\n  - Backward compatible - methods without `self` still work\n\n* **Type System** (v0.1.0)\n  - Optional type annotations\n  - Type inference\n  - Type checking for assignments and function calls\n  - Gradual typing - mix typed and untyped code\n  - Helpful type mismatch error messages\n\n* **Module System** (v0.1.0)\n  - Import entire modules: `import module_name`\n  - Selective imports: `from module_name import func1, func2`\n  - Export declarations: `export func function_name() { }`\n  - Module caching and circular import detection\n\n* **Built-in Functions**\n  - **Math**: `abs()`, `sqrt()`, `pow()`, `floor()`, `ceil()`, `round()`, `min()`, `max()`, `sin()`, `cos()`, `tan()`, constants `PI` and `E`\n  - **Random** (v0.4.0): `random()`, `random_int(min, max)`, `random_choice(array)` - Random number generation\n  - **Strings**: `len()`, `to_upper()`, `to_lower()`, `trim()`, `substring()`, `contains()`, `replace_str()`, `starts_with()`, `ends_with()`, `index_of()`, `repeat()`, `split()`, `join()`\n  - **Regex** (v0.4.0): `regex_match()`, `regex_find_all()`, `regex_replace()`, `regex_split()` - Pattern matching and text processing\n  - **Arrays**: `push()`, `pop()`, `slice()`, `concat()`, `len()`\n  - **Array Higher-Order**: `map()`, `filter()`, `reduce()`, `find()` (v0.3.0)\n  - **Dicts**: `keys()`, `values()`, `has_key()`, `remove()`, `len()`\n  - **JSON**: `parse_json()`, `to_json()` - Parse and serialize JSON data (v0.3.0)\n  - **TOML** (v0.6.0): `parse_toml()`, `to_toml()` - Parse and serialize TOML configuration files\n  - **YAML** (v0.6.0): `parse_yaml()`, `to_yaml()` - Parse and serialize YAML documents\n  - **CSV** (v0.6.0): `parse_csv()`, `to_csv()` - Parse and serialize CSV data files\n  - **Date/Time** (v0.4.0): `now()`, `format_date()`, `parse_date()` - Timestamp and date operations\n  - **System** (v0.4.0): `env()`, `args()`, `exit()`, `sleep()`, `execute()` - System operations\n  - **Paths** (v0.4.0): `join_path()`, `dirname()`, `basename()`, `path_exists()` - Path manipulation\n  - **HTTP** (v0.5.0): `http_get()`, `http_post()`, `http_put()`, `http_delete()`, `http_server()`, `http_response()`, `json_response()`, `redirect_response()`, `set_header()` (v0.5.1), `set_headers()` (v0.5.1) - HTTP client and server with full header control\n  - **Concurrency \u0026 Parallelism** (v0.6.0): `spawn { }`, `parallel_http()`, `channel()`, `chan.send()`, `chan.receive()` - Background tasks and parallel HTTP requests for 3x faster API calls\n  - **HTTP Authentication** (v0.6.0): `jwt_encode()`, `jwt_decode()` - JWT token encoding/decoding for API authentication\n  - **OAuth2** (v0.6.0): `oauth2_auth_url()`, `oauth2_get_token()` - OAuth2 flow helpers for third-party authentication\n  - **HTTP Streaming** (v0.6.0): `http_get_stream()` - Memory-efficient downloads for large files\n  - **Binary Files** (v0.6.0): `http_get_binary()`, `read_binary_file()`, `write_binary_file()`, `encode_base64()`, `decode_base64()` - Download and work with binary data (images, PDFs, archives)\n  - **Image Processing** (v0.6.0): `load_image()`, `img.resize()`, `img.crop()`, `img.rotate()`, `img.flip()`, `img.to_grayscale()`, `img.blur()`, `img.adjust_brightness()`, `img.adjust_contrast()`, `img.save()` - Load, manipulate, and save images (JPEG, PNG, WebP, GIF, BMP)\n  - **Database** (v0.6.0): `db_connect(db_type, connection_string)` - Unified database API supporting SQLite ✅, PostgreSQL ✅, and MySQL ✅, `db_execute()`, `db_query()`, `db_close()`, `db_begin()`, `db_commit()`, `db_rollback()` - Full CRUD operations with transactions and connection pooling\n  - **I/O**: `print()`, `input()`\n  - **Type Conversion**: `parse_int()`, `parse_float()`\n  - **File I/O**: `read_file()`, `write_file()`, `append_file()`, `file_exists()`, `read_lines()`, `list_dir()`, `create_dir()`\n  - **Error handling**: `throw()`\n\n* **Operators**\n  - Arithmetic: `+`, `-`, `*`, `/`, `%` (modulo - v0.3.0)\n  - Comparison: `==`, `!=` (v0.3.0), `\u003e`, `\u003c`, `\u003e=`, `\u003c=` (return `true`/`false` - v0.3.0)\n  - String concatenation with `+`\n  - **Method Chaining** (v0.6.0):\n    - **Null coalescing** `??`: Return left value if not null, otherwise right value\n      ```ruff\n      username := user?.name ?? \"Anonymous\"\n      ```\n    - **Optional chaining** `?.`: Safely access fields, returns null if left side is null\n      ```ruff\n      email := user?.profile?.email  # Returns null if any part is null\n      ```\n    - **Pipe operator** `|\u003e`: Pass value as first argument to function\n      ```ruff\n      result := 5 |\u003e double |\u003e add_ten |\u003e square  # Functional data pipelines\n      ```\n  - **Operator Overloading** (v0.4.0+): Structs can define custom operator behavior\n    - Binary operators: `op_add`, `op_sub`, `op_mul`, `op_div`, `op_mod`, `op_eq`, `op_ne`, `op_gt`, `op_lt`, `op_ge`, `op_le`\n    - Unary operators: `op_neg` (unary minus `-`), `op_not` (logical not `!`)\n\n* **Error Messages**\n  - Colored error output\n  - Source location tracking\n  - Line and column information\n\n* **Testing Framework**\n  - Built-in test runner\n  - Snapshot testing with `.out` files\n  - Test result reporting\n\n---\n\n## Installation\n\nSee [Install Guide](INSTALLATION.md) for platform setup instructions.\n\n---\n\n## Getting Started\n\nInstall Rust and run:\n\n```bash\n# Clean output (recommended)\ncargo run --quiet -- run examples/your_script.ruff\n\n# Or with build messages\ncargo run -- run examples/your_script.ruff\n```\n\n---\n\n## � Interactive REPL (v0.5.0)\n\nLaunch the interactive shell for experimentation and learning:\n\n```bash\ncargo run --quiet -- repl\n```\n\nThe REPL provides a powerful interactive environment:\n\n**Features**:\n- ✅ **Multi-line input** - Automatically detects incomplete statements\n- ✅ **Command history** - Navigate with up/down arrows\n- ✅ **Line editing** - Full cursor movement and editing support\n- ✅ **Persistent state** - Variables and functions stay defined\n- ✅ **Pretty output** - Colored, formatted value display\n- ✅ **Special commands** - `:help`, `:quit`, `:clear`, `:vars`, `:reset`\n\n**Example Session**:\n\n```\n╔══════════════════════════════════════════════════════╗\n║          Ruff REPL v0.5.0 - Interactive Shell        ║\n╚══════════════════════════════════════════════════════╝\n\n  Welcome! Use :help for commands or :quit\n  Tip: Multi-line input: End with unclosed braces\n\nruff\u003e let x := 42\nruff\u003e x * 2\n=\u003e 84\n\nruff\u003e func factorial(n) {\n....\u003e     if n \u003c= 1 {\n....\u003e         return 1\n....\u003e     }\n....\u003e     return n * factorial(n - 1)\n....\u003e }\n\nruff\u003e factorial(5)\n=\u003e 120\n\nruff\u003e let names := [\"Alice\", \"Bob\", \"Charlie\"]\nruff\u003e names\n=\u003e [\"Alice\", \"Bob\", \"Charlie\"]\n\nruff\u003e :help\n# Shows available commands\n\nruff\u003e :quit\nGoodbye!\n```\n\n**Tips**:\n- Type `:help` to see all available commands\n- Press Ctrl+C to interrupt current input\n- Press Ctrl+D or type `:quit` to exit\n- Leave braces unclosed for multi-line input\n- Any expression automatically prints its result\n\n---\n\n## Writing `.ruff` Scripts\n\nExample:\n\n```ruff\nenum Result {\n    Ok,\n    Err\n}\n\nfunc check(x) {\n    if x \u003e 0 {\n        return Result::Ok(\"great\")\n    }\n    return Result::Err(\"bad\")\n}\n\nres := check(42)\n\nmatch res {\n    case Result::Ok(msg): {\n        print(\"✓\", msg)\n    }\n    case Result::Err(err): {\n        print(\"✗\", err)\n    }\n}\n```\n\n### Enhanced Error Handling (v0.4.0)\n\nComprehensive error handling with error properties, custom error types, and stack traces:\n\n```ruff\n# Access error properties\ntry {\n    throw(\"Something went wrong\")\n} except err {\n    print(\"Message:\", err.message)\n    print(\"Line:\", err.line)\n    print(\"Stack depth:\", len(err.stack))\n}\n\n# Custom error types with structs\nstruct ValidationError {\n    field: string,\n    message: string\n}\n\nfunc validate_email(email: string) {\n    if !contains(email, \"@\") {\n        error := ValidationError {\n            field: \"email\",\n            message: \"Email must contain @ symbol\"\n        }\n        throw(error)\n    }\n}\n\ntry {\n    validate_email(\"invalid\")\n} except err {\n    print(\"Validation failed:\", err.message)\n}\n\n# Error chaining with cause\nstruct DatabaseError {\n    message: string,\n    cause: string\n}\n\ntry {\n    connect_to_db()\n} except conn_err {\n    error := DatabaseError {\n        message: \"Failed to initialize app\",\n        cause: conn_err.message\n    }\n    throw(error)\n}\n\n# Stack traces from nested function calls\nfunc inner() {\n    throw(\"Error from inner\")\n}\n\nfunc outer() {\n    inner()\n}\n\ntry {\n    outer()\n} except err {\n    print(\"Error:\", err.message)\n    print(\"Call stack:\", err.stack)\n}\n```\n\n### HTTP Server \u0026 Client (v0.5.0)\n\nBuild HTTP servers and make HTTP requests with ease:\n\n**HTTP Client**:\n```ruff\n# Make HTTP GET request\nresult := http_get(\"https://api.example.com/users\")\nif result.is_ok {\n    data := result.value\n    print(\"Status:\", data[\"status\"])\n    print(\"Body:\", data[\"body\"])\n}\n\n# POST request with JSON body\nuser_data := {\"name\": \"Alice\", \"email\": \"alice@example.com\"}\nresult := http_post(\"https://api.example.com/users\", user_data)\n\n# PUT and DELETE requests\nhttp_put(\"https://api.example.com/users/1\", {\"name\": \"Bob\"})\nhttp_delete(\"https://api.example.com/users/1\")\n```\n\n**HTTP Server**:\n```ruff\n# Create HTTP server on port 8080\nserver := http_server(8080)\n\n# Register GET route\nserver.route(\"GET\", \"/hello\", func(request) {\n    return http_response(200, \"Hello, World!\")\n})\n\n# Register POST route with JSON response\nserver.route(\"POST\", \"/api/data\", func(request) {\n    data := {\"received\": request.body, \"method\": request.method}\n    return json_response(200, data)\n})\n\n# Start server (blocks and handles requests)\nprint(\"Server listening on http://localhost:8080\")\nserver.listen()\n```\n\n**REST API Example**:\n```ruff\n# In-memory data store\ntodos := []\n\nserver := http_server(8080)\n\n# GET all todos\nserver.route(\"GET\", \"/todos\", func(request) {\n    return json_response(200, todos)\n})\n\n# POST new todo\nserver.route(\"POST\", \"/todos\", func(request) {\n    todo := parse_json(request.body)\n    push(todos, todo)\n    return json_response(201, todo)\n})\n\nprint(\"REST API running on http://localhost:8080\")\nserver.listen()\n```\n\n### Binary File Operations (v0.6.0)\n\nDownload and work with binary files like images, PDFs, and archives:\n\n```ruff\n# Download binary file from URL\nimage_data := http_get_binary(\"https://example.com/photo.jpg\")\nwrite_binary_file(\"photo.jpg\", image_data)\nprint(\"Downloaded:\", len(image_data), \"bytes\")\n\n# Read binary file\nfile_bytes := read_binary_file(\"document.pdf\")\n\n# Base64 encoding for API transfers\nbase64_str := encode_base64(file_bytes)  # Also accepts strings\ndecoded := decode_base64(base64_str)\n\n# Example: Download AI-generated image\n# After calling image generation API...\ngenerated_url := api_response[\"image_url\"]\nimage := http_get_binary(generated_url)\nwrite_binary_file(\"ai_generated.png\", image)\n\n# Embed in JSON\njson_payload := {\n    \"image\": encode_base64(image),\n    \"format\": \"png\"\n}\n```\n\n**HTTP Headers** (v0.5.1):\n```ruff\n# Add individual headers\nresponse := http_response(200, \"Success\")\nresponse := set_header(response, \"X-API-Version\", \"1.0\")\nresponse := set_header(response, \"Cache-Control\", \"max-age=3600\")\n\n# Set multiple headers at once\nheaders := {\n    \"X-Request-ID\": \"abc-123\",\n    \"X-Rate-Limit\": \"1000\",\n    \"Access-Control-Allow-Origin\": \"*\"\n}\nresponse := set_headers(response, headers)\n\n# JSON responses automatically include Content-Type\njson := json_response(200, {\"status\": \"success\"})  # Includes Content-Type: application/json\n\n# Redirects with custom headers\nredirect_headers := {\"X-Redirect-Reason\": \"Moved permanently\"}\nredirect := redirect_response(\"https://new-url.com\", redirect_headers)\n\n# Access request headers in route handlers\nserver.route(\"POST\", \"/api/upload\", func(request) {\n    content_type := request.headers[\"Content-Type\"]\n    auth_token := request.headers[\"Authorization\"]\n    \n    if content_type != \"application/json\" {\n        return http_response(400, \"Invalid Content-Type\")\n    }\n    \n    response := json_response(200, {\"uploaded\": true})\n    return set_header(response, \"X-Upload-ID\", \"upload-123\")\n})\n```\n\n**Key Features**:\n- HTTP methods: GET, POST, PUT, DELETE\n- Path-based routing with exact matching\n- JSON request/response handling\n- Automatic request body parsing\n- Request body parsing (JSON)\n\n### Concurrency \u0026 Parallelism (v0.6.0)\n\nRun code concurrently for faster AI tools, batch processing, and non-blocking operations:\n\n**Parallel HTTP Requests** (3x faster for AI model comparison):\n```ruff\n# Query multiple AI providers simultaneously\nurls := [\n    \"https://api.openai.com/v1/chat/completions\",\n    \"https://api.anthropic.com/v1/messages\",\n    \"https://api.deepseek.com/v1/chat/completions\"\n]\n\n# All 3 requests happen in parallel - returns in ~2s instead of 6s!\nresults := parallel_http(urls)\n\nfor result in results {\n    print(\"Status: \" + result[\"status\"])\n    print(\"Response: \" + result[\"body\"])\n}\n```\n\n**Background Tasks with spawn**:\n```ruff\n# Fire and forget - main thread continues immediately\nspawn {\n    print(\"Processing in background...\")\n    process_large_file()\n}\n\nprint(\"Main thread continues without waiting\")\n```\n\n**Thread Communication with Channels**:\n```ruff\nchan := channel()\n\nspawn {\n    result := expensive_computation()\n    chan.send(result)\n}\n\n# Receive result from background thread\nvalue := chan.receive()\nprint(\"Got result: \" + value)\n```\n\n**Key Features**:\n- **3x faster** parallel HTTP requests for AI model comparison\n- Non-blocking background tasks with `spawn`\n- Thread-safe communication with channels\n- Perfect for batch processing and data pipelines\n\n### Image Processing (v0.6.0)\n\nLoad, manipulate, and save images with built-in support for JPEG, PNG, WebP, GIF, and BMP:\n\n```ruff\n# Load and inspect image\nimg := load_image(\"photo.jpg\")\nprint(\"Size: \" + img.width + \"x\" + img.height)\nprint(\"Format: \" + img.format)\n\n# Create thumbnail (maintain aspect ratio)\nthumb := img.resize(200, 200, \"fit\")\nthumb.save(\"thumbnail.jpg\")\n\n# Exact dimensions\nresized := img.resize(800, 600)\nresized.save(\"resized.jpg\")\n\n# Crop region (x, y, width, height)\ncropped := img.crop(100, 100, 400, 300)\ncropped.save(\"cropped.jpg\")\n\n# Transformations\nrotated := img.rotate(90)  # 90, 180, or 270 degrees\nflipped := img.flip(\"horizontal\")  # or \"vertical\"\n\n# Filters and adjustments\ngray := img.to_grayscale()\nblurred := img.blur(5.0)  # sigma value\nbrighter := img.adjust_brightness(1.2)  # 20% brighter\ncontrast := img.adjust_contrast(1.3)  # More contrast\n\n# Method chaining for complex workflows\nenhanced := img\n    .resize(800, 600)\n    .adjust_brightness(1.1)\n    .adjust_contrast(1.15)\n    .to_grayscale()\n\nenhanced.save(\"enhanced.jpg\")\n\n# Format conversion (auto-detects from extension)\nimg.save(\"output.png\")  # JPEG -\u003e PNG\nimg.save(\"output.webp\")  # JPEG -\u003e WebP\n\n# Batch processing\nimages := [\"img1.jpg\", \"img2.jpg\", \"img3.jpg\"]\nfor path in images {\n    img := load_image(path)\n    thumb := img.resize(200, 200, \"fit\")\n    \n    # Extract filename\n    parts := split(path, \".\")\n    name := parts[0]\n    \n    thumb.save(\"thumbs/\" + name + \"_thumb.jpg\")\n}\n\n# Social media image prep\nfunc prepare_instagram_post(image_path) {\n    img := load_image(image_path)\n    \n    # Instagram: 1080x1080\n    resized := img.resize(1080, 1080, \"fit\")\n    \n    # Enhance for social media\n    enhanced := resized\n        .adjust_brightness(1.1)\n        .adjust_contrast(1.15)\n    \n    enhanced.save(\"instagram_post.jpg\")\n}\n```\n\n**Supported Operations**:\n- Load/save: JPEG, PNG, WebP, GIF, BMP\n- Resize: exact dimensions or maintain aspect ratio\n- Transform: crop, rotate (90/180/270), flip (h/v)\n- Filters: grayscale, blur (Gaussian)\n- Adjust: brightness, contrast\n- Properties: width, height, format\n- Method chaining for complex workflows\n- Error handling for missing/invalid files\n\n- Built-in response helpers\n- Error handling with proper status codes\n- Full header control:\n  - Custom response headers\n  - Automatic headers (Content-Type for JSON)\n  - Request header access\n  - CORS support\n  - Security headers\n\nSee [examples/http_server_simple.ruff](examples/http_server_simple.ruff), [examples/http_rest_api.ruff](examples/http_rest_api.ruff), [examples/http_client.ruff](examples/http_client.ruff), [examples/http_webhook.ruff](examples/http_webhook.ruff), and [examples/http_headers_demo.ruff](examples/http_headers_demo.ruff) for complete examples.\n\n### Unified Database API (v0.7.0) 🗄️\n\nRuff includes a unified database API that works across different database backends. Currently supports **SQLite**, **PostgreSQL**, and **MySQL**:\n\n```ruff\n# SQLite - Perfect for local apps and embedded databases\ndb := db_connect(\"sqlite\", \"myapp.db\")\ndb_execute(db, \"CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)\", [])\ndb_execute(db, \"INSERT INTO users (name, email) VALUES (?, ?)\", [\"Alice\", \"alice@example.com\"])\nusers := db_query(db, \"SELECT * FROM users\", [])\n\n# PostgreSQL - Perfect for production web applications  \ndb := db_connect(\"postgres\", \"host=localhost dbname=myapp user=admin password=secret\")\ndb_execute(db, \"CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY, name TEXT, email TEXT)\", [])\ndb_execute(db, \"INSERT INTO users (name, email) VALUES ($1, $2)\", [\"Alice\", \"alice@example.com\"])\nusers := db_query(db, \"SELECT * FROM users\", [])\n\n# MySQL - Perfect for traditional web applications\ndb := db_connect(\"mysql\", \"mysql://root@localhost:3306/myapp\")\ndb_execute(db, \"CREATE TABLE IF NOT EXISTS users (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), email VARCHAR(100))\", [])\ndb_execute(db, \"INSERT INTO users (name, email) VALUES (?, ?)\", [\"Alice\", \"alice@example.com\"])\nusers := db_query(db, \"SELECT * FROM users\", [])\n\n# Same Ruff code works with all databases!\nfor user in users {\n    print(\"User: \" + user[\"name\"] + \" - \" + user[\"email\"])\n}\n\n# Query with parameters (prevents SQL injection)\nbob := db_query(db, \"SELECT * FROM users WHERE name = $1\", [\"Bob\"])  # PostgreSQL uses $1, $2\n# bob := db_query(db, \"SELECT * FROM users WHERE name = ?\", [\"Bob\"])   # SQLite \u0026 MySQL use ?\n\n# Update and delete\ndb_execute(db, \"UPDATE users SET email = $1 WHERE name = $2\", [\"alice@newmail.com\", \"Alice\"])\ndb_execute(db, \"DELETE FROM users WHERE name = $1\", [\"Bob\"])\n\n# Close connection\ndb_close(db)\n```\n\n**Key Features**:\n- **Unified API**: Same `db_connect()`, `db_execute()`, and `db_query()` functions work across all databases\n- **SQLite Support**: `?` placeholders for parameters\n- **PostgreSQL Support**: `$1, $2, $3` placeholders for parameters\n- **MySQL Support**: `?` placeholders for parameters (async driver with transparent blocking)\n- **Parameter Binding**: Prevents SQL injection attacks\n- **Type Safety**: Returns proper Null values for NULL database fields\n- **Type Support**: Integers, floats, strings, booleans, and NULL\n- **Multi-Backend Ready**: Switch databases by changing connection string only\n\n**Database-Specific Syntax Notes**:\n- **SQLite**: Uses `?` for parameters: `INSERT INTO users VALUES (?, ?)`\n- **PostgreSQL**: Uses `$1, $2` for parameters: `INSERT INTO users VALUES ($1, $2)`\n- **MySQL**: Uses `?` for parameters: `INSERT INTO users VALUES (?, ?)`\n- Everything else is the same Ruff code!\n\nSee `examples/database_unified.ruff` for comprehensive SQLite examples, `examples/database_postgres.ruff` for PostgreSQL examples, `examples/database_mysql.ruff` for MySQL examples, and `examples/projects/url_shortener.ruff` for a complete URL shortener using SQLite with an HTTP server.\n\n### String Interpolation (v0.3.0)\n\n```ruff\nname := \"Alice\"\nage := 30\nscore := 95\n\n# Embed expressions directly in strings\ngreeting := \"Hello, ${name}!\"\nbio := \"${name} is ${age} years old\"\nresult := \"Score: ${score}/100 (${score \u003e= 90}% = A)\"\n\nprint(greeting)  # Hello, Alice!\nprint(bio)       # Alice is 30 years old\nprint(result)    # Score: 95/100 (true% = A)\n\n# Complex expressions with parentheses\na := 2\nb := 3\nc := 4\ncalculation := \"Result: (${a} + ${b}) * ${c} = ${(a + b) * c}\"\nprint(calculation)  # Result: (2 + 3) * 4 = 20\n```\n\n### Comments (v0.3.0)\n\nRuff supports three types of comments:\n\n```ruff\n# Single-line comment\n# These continue to end of line\n\n/*\n * Multi-line comments\n * Span multiple lines\n * Useful for longer explanations\n */\n\n/// Doc comments for documentation\n/// @param x The input value\n/// @return The result\nfunc square(x) {\n    return x * x  /* inline comment */\n}\n\n# All comment types work together\n/*\n * Block comment explaining the algorithm\n */\n/// Documentation for the function\nfunc calculate(n) {\n    # Implementation details\n    return n * 2\n}\n```\n\nSee [examples/comments.ruff](examples/comments.ruff) for comprehensive examples.\n\n---\n\n## Running Tests\n\nPlace test files in the `tests/` directory. Each `.ruff` file can have a matching `.out` file for expected output:\n\n```bash\ncargo run -- test\n```\n\nTo regenerate expected `.out` snapshots:\n\n```bash\ncargo run -- test --update\n```\n\n---\n\n## Language Features\n\n* ✅ Mutable/const variables with optional type annotations\n* ✅ Functions with return values and type annotations\n* ✅ Pattern matching with `match`/`case`\n* ✅ Enums with tagged variants\n* ✅ Nested pattern matches\n* ✅ `try`/`except`/`throw` error handling\n* ✅ Structs with fields and methods (v0.2.0)\n* ✅ Arrays with element assignment and iteration (v0.2.0)\n* ✅ Dictionaries (hash maps) with built-in methods (v0.2.0)\n* ✅ For-in loops over arrays, dicts, strings, and ranges (v0.2.0)\n* ✅ Built-in collection methods: `push()`, `pop()`, `slice()`, `concat()`, `keys()`, `values()`, `has_key()`, `remove()`, `len()` (v0.2.0)\n* ✅ Type system with type checking and inference (v0.1.0)\n* ✅ Module system with import/export (v0.1.0)\n* ✅ String interpolation with `${}` syntax (v0.3.0)\n* ✅ Boolean type as first-class value (v0.3.0)\n* ✅ Loop control with `while`, `break`, and `continue` (v0.3.0)\n* ✅ Lexical scoping with proper environment stack (v0.3.0)\n* ✅ Multi-line and doc comments (v0.3.0)\n* ✅ Standard library with math, string, and I/O functions\n* ✅ CLI testing framework with snapshot testing\n* ✅ Colored error messages with source location tracking\n\n---\n\n## Roadmap\n\nSee [ROADMAP.md](ROADMAP.md) for detailed feature plans.\n\n---\n\n## Contributing\n\nView the [CONTRIBUTING](CONTRIBUTING.md) document.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frufflang%2Fruff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frufflang%2Fruff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frufflang%2Fruff/lists"}