Skip to content

Compound resources#573

Open
pschachte wants to merge 12 commits into
masterfrom
compound-resources
Open

Compound resources#573
pschachte wants to merge 12 commits into
masterfrom
compound-resources

Conversation

@pschachte

Copy link
Copy Markdown
Owner

Allow resources to be defined as the union of other resources. Using those resources then specifies that all the constituent resources are actually used. This gives a more concise syntax for specifying use of a collection of resources.

pschachte added 9 commits June 9, 2026 14:56
  * add warnings for empty compound resources
  * change version in wybe.cabal to 0.2.0.0
  * update Makefile to read version from wybe.cabal
Uniqueness checking foils including unique resources such as !io in a
compound resource.
Updated compound_resource test case to cover this.

Please check the change to
test-cases/final-dump/constant_type_constraint_error.exp
I suspect this comes from the change to handling of `=`, and I'm not
sure if the change is good or bad.
@pschachte

Copy link
Copy Markdown
Owner Author

Closes #46

Comment thread src/Flatten.hs
Comment thread src/Resources.hs Outdated

@jimbxb jimbxb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This program

resource foo = bar

pass

compiles with no error, but it ought to be erroneous as the bar resource is undefined.

@pschachte

Copy link
Copy Markdown
Owner Author

OK, I think all issues have been addressed.

@jimbxb

jimbxb commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Yes, looks good.

Though, a test case with a compound resource in a use block would be useful.

resource foo = bar, baz
resource bar:int = 1
resource baz:int

use foo in {
    ?baz = 1
    !use_baz
    !use_foo
    !use_bar
}

def use_foo use !foo, !io {
    !println("$bar, $baz")
    ?bar = 10
}
def use_bar use bar, !io {
    !println(bar)
}
def use_baz use baz, !io {
    !printin(baz)
}

@pschachte pschachte requested a review from jimbxb June 25, 2026 07:45
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