Giter Club home page Giter Club logo

Comments (3)

dedbox avatar dedbox commented on May 23, 2024 2

While I agree a pattern-friendly syntax for args with defaults would be good, I think making match patterns appear more like syntax patterns would be a mistake unless we also intend to unify the semantics (and consequent developer experience) of expansion and evaluation. See #23 for my rationale.

from rhombus-prototype.

AlexKnauth avatar AlexKnauth commented on May 23, 2024

Cross-reference with point (4) of #23, since the syntax of patterns affects whether they can be used unambiguously in things like optional-arguments with defaults in define, as @dedbox pointed out

from rhombus-prototype.

rocketnia avatar rocketnia commented on May 23, 2024

If syntax-parse is merged with matching and matching is used for argument lists, then I think the syntax would change in a way that's something like this:

; before
(define (my-print [out (current-output-port)])
  ...)

; after
(define (my-print {~optional out #:defaults ([out (current-output-port)])})
  ...)

; after defining a `define-splicing-syntax-class` helper
; (or maybe it would be `define-splicing-class`)
(define (my-print {~opt out (current-output-port)})
  ...)

The ambiguity would have come from the original syntax's use of parens without a prefix operator inside them. The revision just adds ~opt to keep it clear why the parens are there.

from rhombus-prototype.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.