Giter Site home page Giter Site logo

Comments (3)

mainland avatar mainland commented on July 25, 2024

You're right, it is inconsistent. I have in the past considered making the change you are suggesting, but decided not to because it would require changing a lot of client code.

As for $idname:x, is x the Name of a Haskell variable that contains a value of type Id? Are you generating Haskell code that generates C code? Or is the Name supposed to be converted to a value of type Id?

Let me propose a different approach that I think would address all of these issues. There is currently a ToExp class in Language.C.Quote, and any value with a type that has a visible instance of ToExp can appear as the argument to an $exp antiquotation, i.e., $exp:e is valid for any e that has a type that is an instance of ToExp. When the antiquotation is expanded, toExp e is spliced in. We could add a ToIdent class and define instances for both String and Id. That would retain backwards compatibility, support antiquoting values of type Id, avoid adding yet another type of antiquotation, and allow us (or library clients) to add new instances in the future---like yours for Name.

Sound good?

from language-c-quote.

mainland avatar mainland commented on July 25, 2024

$id:x now allows x to have type Id.

from language-c-quote.

mchakravarty avatar mchakravarty commented on July 25, 2024

Great — thanks!

from language-c-quote.

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.