Skip to content

Document iftype#580

Open
SeanTAllen wants to merge 1 commit intomainfrom
document-iftype
Open

Document iftype#580
SeanTAllen wants to merge 1 commit intomainfrom
document-iftype

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

Adds documentation for iftype to the control structures page, covering:

  • Basic syntax and compile-time semantics
  • Type narrowing within the then branch
  • elseif chaining for multiple type checks
  • Capability conditions (ref, box, etc.)
  • Tuple conditions for checking multiple type parameters
  • Limitations (left side must be a type parameter)
  • Expression semantics (returns a value, implicit else None)

Includes 5 compilable code samples, updates to the keywords table and
symbol lookup cheat sheet, a cross-reference from the generics constraints
page, and a cspell dictionary addition.

Parked review item

The basic example's else branch prints "woof" (implying a Cat-vs-Dog
dichotomy) rather than something type-neutral like "not a cat". The else
actually catches anything that isn't Cat. The prose explains this correctly
but the example could reinforce a wrong mental model. Low severity —
flagged during review as a pedagogical judgment call.

Closes #393

iftype has been around for a long time but was never documented beyond
a keyword table entry. This adds a full section covering basic syntax,
type narrowing, elseif chaining, capability conditions, tuple conditions,
and limitations, with 5 compilable code samples.

Also updates the keywords table, symbol lookup cheat sheet, and adds a
cross-reference from the generics constraints page.

Closes #393
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 3, 2026

Deploy Preview for pony-tutorial ready!

Name Link
🔨 Latest commit f8bcba0
🔍 Latest deploy log https://app.netlify.com/projects/pony-tutorial/deploys/69cf34f6c02c3b00081e5e83
😎 Deploy Preview https://deploy-preview-580--pony-tutorial.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discuss during sync Should be discussed during an upcoming sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document iftype

2 participants