Skip to content

Ascend 1.0: package manager, C-style syntax, structs, lambdas and a full standard library - #4

Merged
csubbdev merged 4 commits into
mainfrom
claude/bugs-language-improvements-3tbrkx
Nov 3, 2026
Merged

csubbdev merged 4 commits into
mainfrom
claude/bugs-language-improvements-3tbrkx

Conversation

@csubbdev

@csubbdev csubbdev commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Takes Ascend from 0.3 to 1.0 in four steps (one commit each), so it can be used as a general-purpose scripting language.

0.4: apkg, a package manager

  • apkg install / uninstall / list / show / search / init, like pip.
  • Packages come from the registry (colors, colors@1.0.0), GitHub (github:user/repo@v1), any git repository, or a local folder. Dependencies are installed with them.
  • Projects keep packages in ascend_packages/ and list them in ascend.json. import finds installed packages.
  • The registry (registry/index.json) starts with three packages written in Ascend: colors, strings, testing.

0.5: C-style syntax, imports, structs, enums

  • for (i32 i = 0; i < n; i++), i++/--i, switch/case/default with fall-through, do/while.
  • Bodies without braces, casts like (f64) x, auto, double/long/short.
  • A main() that runs automatically, and printf/sprintf.
  • Import statements: import geometry, import lib.shapes as s, from geometry import area.
  • struct with typed fields, and enum.
  • Regex and folder builtins.
  • Fixes floats like 20.0 printing as 2e+01.

0.6: functions and expressions

  • Struct methods with this and init().
  • Lambdas (x => x * 2), list and map comprehensions, and ranges (0..n, 1..=n).
  • Destructuring (a, b = b, a, return lo, hi).
  • ?? and ?., named arguments, ...rest parameters and spreading.
  • finally, raw strings (r"...") and multi-line strings ("""...""").

1.0: complete the language and library

  • Inheritance (struct Dog : Animal, super.method(), is_a).
  • Operator overloading (operator+, ==, <, [], ...) and the special methods to_string, iter, len, contains.
  • Typed collections list<T> and map<K, V>, checked when stored and on every later change.
  • Tracebacks for uncaught errors.
  • Recursion up to 100,000 calls deep (it was about 2,000): programs now run on a thread with a large stack.
  • ascend test runs *_test.asc files.
  • run() captures a program's output.
  • HTTP via curl: http_get, http_post, http_request.
  • Path and folder helpers; CSV, base64, SHA-256, UUIDs, dates; set operations; more string and math functions.

Testing

  • 170 unit tests and every example program (22 CTest entries) pass on Linux with GCC and with Clang (-Wshadow -Wconversion, no warnings), and under AddressSanitizer and UndefinedBehaviorSanitizer with leak detection.
  • The package manager tests install from the in-repo registry and from temporary git repositories.
  • The workflow was run by hand on this branch after each of the first three steps; all five jobs passed (Linux GCC/Clang, macOS, Windows MSVC, sanitizers).
  • http_get and http_post were tried against real servers. The unit tests only cover what works without a network.

Docs updated: docs/syntax.md, docs/standard_library.md, the new docs/packages.md, README.md and CHANGELOG.md. The VS Code grammar now highlights the new syntax.


Generated by Claude Code

C-style code now works: for (init; cond; step) loops (also without
parentheses, with comma-separated parts, and `for {}`), ++ and --,
switch/case/default with fall-through, do/while, bodies without braces,
casts like (f64) x, `i32 a = 1, b = 2`, double/long/short, `auto`, and
a main() that runs automatically. printf and sprintf take C formats.

Imports are statements now: `import geometry`, `import lib.shapes as
s`, `import "path" as x`, `from geometry import area, Point as P` and
`from m import *`. The import() function still works.

`struct Point { f64 x; f64 y = 0 }` declares a type with typed fields
and a constructor; struct names work as types everywhere. `enum Color {
Red, Green }` makes a constant map. New regex_* and folder builtins.

Also fixes floats like 20.0 printing as 2e+01.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014xWEy3pVr7ofMaomGRbiuo
- Struct methods with `this`, and init() that runs when a value is made
- Lambdas: x => x * 2, (a, b) => a + b, (i32 n) => { ... }
- List and map comprehensions with nested for and if clauses
- Destructuring: a, b := 1, 2; a, b = b, a; return a, b; x, y := point
- Ranges 0..n and 1..=n (ints and chars), lazy in for/in/switch/match
- Null-safe operators ?? and ?.
- Named arguments for functions and struct constructors
- Variadic ...rest parameters, and ... to spread lists and maps
- finally blocks
- Raw strings r"..." and multi-line strings """..."""
- group_by, count_by, chunk, flat_map, min_by, max_by, mean, median

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014xWEy3pVr7ofMaomGRbiuo
…brary

- Inheritance with `struct Dog : Animal`, super.method() and is_a()
- Operator overloading (operator+ - * / % ** == < []) and special
  methods to_string(), iter(), len() and contains()
- Typed collections list<T> and map<K, V>, checked on assignment and
  on later push/insert/extend/element assignment
- Tracebacks for uncaught errors through function calls
- Programs run on a thread with a large stack: recursion can go
  100,000 calls deep instead of about 2,000
- `ascend test` runs *_test.asc / test_*.asc files
- run() captures program output; http_get/http_post/http_request via
  curl; walk_dir, remove_dir, copy_file, move_file, file_size, path
  helpers, cwd/chdir/temp_dir, set_env, platform
- csv_parse/csv_stringify, base64, sha256, uuid, now/format_time,
  capitalize/title/trim_start/trim_end/last_index_of, lcm, factorial,
  trunc, degrees/radians, union/intersect/difference
- New examples (shapes, scripting, geometry_test), docs and changelog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014xWEy3pVr7ofMaomGRbiuo
Where the stack runs out (and so the reported column) depends on the
machine's stack size, which differs between the CI runners. Check the
error and the recursive call in the traceback instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014xWEy3pVr7ofMaomGRbiuo
@csubbdev
csubbdev merged commit a84e7be into main Nov 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants