Skip to content

Convert remaining playground examples to contracts - #17

Merged
Y-Nak merged 7 commits into
contract-first-examplesfrom
convert-remaining-examples
Aug 20, 2026
Merged

Convert remaining playground examples to contracts#17
Y-Nak merged 7 commits into
contract-first-examplesfrom
convert-remaining-examples

Conversation

@czepluch

Copy link
Copy Markdown
Collaborator

Similarly to #16, this PR updates all existing examples to use contracts and get rid of word types etc

  • hello merged into the default example, renamed "Hello contract".
  • std-usage is now a Calculator showing that a + b and Num.add(a, b) are the same trait call.
  • trait is now a LightSwitch whose stored Switch enum is driven by the Toggle impl.
  • generics is replaced by a Registry: a where-constrained generic max working on a user-defined Version through its Eq/Ord impls.
  • comptime is now an Answer contract; comptime works, so no word needed.
  • multi-file retired: the option and mini NFT examples now demonstrate modules in realistic use.
  • lambda retired rather than converted. Flagging this one: closure application over runtime data currently fails Hull emission with SC0422: cannot lower closure dispatch in every shape tried, including higher-order functions taking lambda arguments. The previous example only compiled because all inputs were constants, so partial evaluation erased the closure before the backend ran; no e2e test exercises lambdas. The example should return once closure dispatch lowers to Hull.

@czepluch
czepluch requested a review from Y-Nak August 19, 2026 13:31
@Y-Nak
Y-Nak merged commit 3e5a4d2 into new-syntax Aug 20, 2026
24 checks passed
@Y-Nak
Y-Nak deleted the convert-remaining-examples branch August 20, 2026 09:46
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