Giter VIP home page Giter VIP logo

Comments (1)

yannham avatar yannham commented on May 28, 2024

In all generality, we can't have all identifiers (variable names + field names) be metadata keywords, because it would be ambiguous: would {foo | optional} be an optional field, or a field foo with the optional contract applied?

That being said, I don't see any issue allowing them for fields alone, albeit being slightly more annoying implementation-wise (this is not a good argument, just the reason why it's not already the case 🙂 ).

Such a change raises the following question: how do you recursively refer to such fields, if normal identifiers can't refer to them? for example, you still couldn't write {optional = false, bar = if optional then 1 else 2} (because optional in bar is a normal identifier and can't be a keyword). I imagine the cleaner solution is to add raw identifiers, probably using the syntax r%id and/or r%"id" (maybe r isn't a good prefix, because we probably want raw strings as well). Whatever the syntax is, you could then do {optional = false, if raw_id%optional then 1 else 2}.

In fact this issue is already present today, because you can define fields that aren't valid identifier by enclosing them with quotes: {"some=>field" = true, bar = if ??? then 1 else 2}.

from nickel.

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.