Coder Social home page Coder Social logo

Comments (12)

sunli829 avatar sunli829 commented on April 28, 2024 2

@phated I tried this on a new branch.

In addition, thank you very much for the support of async-graphql. I was even more excited when I found out that you are the main maintainer of glup.js.

from async-graphql.

sunli829 avatar sunli829 commented on April 28, 2024 1

The side effect is improved runtime performance.πŸ˜‚

from async-graphql.

phated avatar phated commented on April 28, 2024

I'm not very happy with this idea.

from async-graphql.

sunli829 avatar sunli829 commented on April 28, 2024

If the interface field types do not match, there is now a panic at Schema::new and a reason is given.

The following code didn't compile well before, but it does now.

struct MyObj;

#[Object]
impl MyObj {
    async fn a(&self) -> &str {}
}

#[Interface(field(name = "a", type = "String"))]
struct MyInterface(MyObj);

This actually seems reasonable, it simplifies the definition of the interface.

from async-graphql.

phated avatar phated commented on April 28, 2024

Panic is not desirable. I believe there is a solution that involves traits but I'm unable to work on it currently.

from async-graphql.

sunli829 avatar sunli829 commented on April 28, 2024

Panic is not desirable. I believe there is a solution that involves traits but I'm unable to work on it currently.

@phated
Thanks for your suggestion.😁 I will make a version as soon as possible and see how it works.

from async-graphql.

phated avatar phated commented on April 28, 2024

@sunli829 is it possible to use a macro to add additional methods to a trait, including a default implementation? That is the solution I am considering.

from async-graphql.

sunli829 avatar sunli829 commented on April 28, 2024

@phated I'm actually hoping to solve this problem #29 and #28. I think procedural macros may not be possible.

from async-graphql.

phated avatar phated commented on April 28, 2024

I am hoping to find time to understand macros better, but my other open source responsibilities are requiring my time right now.

Tomorrow I am giving a presentation on async-graphql and I wanted to show type safety on interfaces.

from async-graphql.

phated avatar phated commented on April 28, 2024

πŸ™‡ Thank you! Your work on this project is amazing and I very much appreciate it! I am excited to help out more.

from async-graphql.

nicolaiunrein avatar nicolaiunrein commented on April 28, 2024

@sunli829 I think it is a great Idea especially when it panics at application start. I never really liked the implementation of Interface. I think it is somehow reversed. Isn’t there a more natural way where Interface behaves more like a trait? So that Objects and SimpleObjects can "implement" it rather than beeing passed into the interface as struct fields? It just feels wrong and doesn’t allow shareing an interface over crate boundaries.

@phated Is your presentation being recorded? I would love to see it.

from async-graphql.

sunli829 avatar sunli829 commented on April 28, 2024

@nicolaiunrein The interface definition is not natural, but it is simple enough to use.😁

from async-graphql.

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.