Skip to content

Commit a1d25ae

Browse files
authored
Multiple rhs (#25)
* notes * more hacking * more hacking * more argh * hackikng away * stuff * start rewriting all pattern matching * pattern match rewrite almost done * pattern match rewrite passes the first test * codegen for multiple rhs passes first test * note another bug * note codegen after parse unit * getting closer * next multidef example works * make later defs local to main def to avoid top level mutual recursion * multiple defs test case three works * add some tests * detect redefinition across parse units * case three works * fix up filemodel merge * fix access to nested structs * more debugging * omg fixed pattern defs * more fixes * fix local multiple defs * tiny * fix Vector ++ Image * fix Image op Vector * add more tests for multiple RHS * ready for 9.0.14 release * fix date
1 parent 4ced551 commit a1d25ae

27 files changed

+3460
-2851
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## master
22

3+
- pattern matching rewrite
4+
- add multiple defs and parameter pattern match to compiler
5+
- add filemodel::new_from_file, rework filemodel_open
6+
- reloading a toolkit now deletes all defs, then does load ... adding a new
7+
def to a func across a parse unit is now an error
8+
39
## 9.0.14 2025/10/25
410

511
- fix load cancel

TODO

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,54 @@
1-
- should allow vips_image ++ Image
1+
- nicholas's bug report
22

3-
- remove remove prefs workspace stuff?
3+
- lcomps leave stray unreffed symbols in "list unresolved"
44

5-
things like max heap size should be settable ... maybe pres are useful?
5+
Image_transform_item.Resize_item.Size_within_item.action.within ($SAVEDIR/start/Image.def:509) refers to undefined symbol h
6+
Image_transform_item.Resize_item.Size_within_item.action.within ($SAVEDIR/start/Image.def:509) refers to undefined symbol w
67

7-
- add multiple definitions, finish function argument destructuring
8+
- rework pattern matching in lcomps
89

9-
sym has a field for "next definition", initially NULL
10+
- what does the programming window do for multiple defs?
1011

11-
` add_defining looks for an existing sym with this name, if it finds
12-
one, add a new sym called "{name}-$$4" or whatever
12+
probably need to follow next_def and concatenate them all
1313

14-
chase to the end of "next definition" on the existing sym, append our
15-
new sym
14+
- dir should hide $$vars
1615

17-
during compile, generate code like
16+
- programming window is showing generated syms, like $$pattern_lhs0?
1817

19-
fred a b c
20-
= destructured_fred, args_match
21-
= fred-$$1 a b c
22-
{
23-
destructured_fred = rhs of fred
24-
args_match = a_matches && b_matches && c_matches
25-
}
18+
- ban patterns in class parameters
19+
20+
or could we allow multiple class defs?
21+
22+
Fred (Image x) = class { ... };
2623

27-
if a func has many RHS and the last RHS uses destrucuring, generate a
28-
final def with
24+
probably only useful for trivial classes
25+
26+
- what about
27+
28+
fred (list x) = ...;
29+
fred (complex x) = ...;
30+
31+
ie. allow names of builtin types as well as class names
32+
33+
maybe:
2934

30-
fred a b c
31-
= error "no def of fred matches args a b c";
35+
fred (is_list x) = ...;
3236

33-
- error if more than one def of fred has no destructuring
34-
- error if defs don't all have the same number of args
35-
- error if a def with no destructuring isn't the last def
37+
ie. a predicate before the arg, as well as a class name?
38+
39+
- do we allow eg.
40+
41+
fred [a, b ..] = a + b;
42+
43+
equivalent to
44+
45+
fred a:b:x = a + b;
46+
47+
48+
49+
- remove remove prefs workspace stuff?
50+
51+
things like max heap size should be settable ... maybe pres are useful?
3652

3753
- try < > in the image titlebar
3854

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('nip4', 'c',
22
# ie. a major after nip2 8.9 for workspace save file versioning
3-
version: '9.0.14',
3+
version: '9.0.15',
44
license: 'GPL',
55
meson_version: '>=0.64',
66
default_options: [

0 commit comments

Comments
 (0)