Giter VIP home page Giter VIP logo

Comments (4)

edemaine avatar edemaine commented on September 8, 2024

This is either a documentation bug or a compiler bug. ๐Ÿ™‚

We have been discussing recently whether to make a?b shorthand for a?.b (an extension of #1327). In fact, I was inclined to implement this very soon. But it would mean that a?b:c wouldn't be a valid ternary. Which do we want?

from civet.

STRd6 avatar STRd6 commented on September 8, 2024

For now I think we should note it in the docs. We may be able to accommodate both with proper look-ahead but we'd need to make sure all the edge cases work out correctly.

from civet.

edemaine avatar edemaine commented on September 8, 2024

Ah, fair, I think it's reasonable to require no spaces around the colon when there's no spaces around the question mark in a ternary, and this could probably be supported together with a?b.

from civet.

edemaine avatar edemaine commented on September 8, 2024

I've gone ahead and documented the current behavior. Supporting tight ternary x?y:z is still interesting, but I found it difficult to add in my first attempt (given the current parser, which wants to greedily match an expression before looking for ternary suffix ?...:...).

from civet.

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.