Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sweet-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 62
    • Issues 62
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • sweet-js
  • sweet-core
  • Issues
  • #581
Closed
Open
Issue created Aug 18, 2016 by Administrator@rootContributor

add equivalent of racket's begin-for-syntax

Created by: WreckedAvent

Context:

I want to be able to write private helpers for my macros. Currently, the only way to do this is to have another module which you import. This seems less-than-ideal to me and involves some weirdness like import ... for syntax. I suggest having a syntax block which puts all of the statements into the correct phase to be used in macros.

Example:

syntax {
  let next = ctx => ctx.next().value
  syntax inc = ctx => #`${next(ctx)} + 1`
}

inc 10

would compile to

10 + 1

Considerations:

  • @jlongster mentioned a forSyntax accepting an IIFE to achieve this instead. This seems less intuitive to me.
  • The import ... for syntax could be implied within a syntax block
  • syntax identifier seems kind of awkward to me inside of a syntax block but not sure if there's any better ways to approach it
Assignee
Assign to
Time tracking