Giter Site home page Giter Site logo

Comments (7)

romandev avatar romandev commented on May 22, 2024

@yjaeseok Are you interested in this issue?

from bacardi.

yjaeseok avatar yjaeseok commented on May 22, 2024

Yes I am interested in this issue, But i have some question.

Calculator has only function (looks like static function), so user do not want to use constructor as class.
If we were to show the constructor correctly, would we need an example with member variables and functions or inheritance?

from bacardi.

romandev avatar romandev commented on May 22, 2024

Hi, @yjaeseok
We can add a constructor in Calculator example for now as follows:

[
    Constructor,
    Constructor(double createdTime)
]
interface Calculator {
    static void print();
    double add(double number1, double number2);
    ...
};

Then, our generator should generate glue codes(bridge codes) and then it should eventually call
developer's cpp constructor.

class Calculator {
 public:
  Calculator() {
    ...
  }

  Calculator(double created_time) {
    ...
  }
};

Yes, we might need variables and inheritance but it's not ready yet. We can implement them incrementally. :)

from bacardi.

yjaeseok avatar yjaeseok commented on May 22, 2024

Hmm..
I have tried many ways It seems that it is hard to apply patch because of lack of understand concept. Could you help me with some advise?
@romandev

from bacardi.

yjaeseok avatar yjaeseok commented on May 22, 2024

How could I get constructor value in template_cpp.njk file?

I think i have to modify idls.ts for idl parsing, but i do not understand how to access constructor parameter like member_info variable.

there is no member_info definition in any files.

from bacardi.

romandev avatar romandev commented on May 22, 2024

We might need a new data structure.
For example, we can think the constructor function is a special member of the interface.
It's my own thinking and your design can be different.

export interface InterfaceConstructor extends InterfaceMember {
}

Also, you can get the information from raw_idl_info.extAttrs.
Please see https://github.com/w3c/webidl2.js#extended-attributes

from bacardi.

yjaeseok avatar yjaeseok commented on May 22, 2024

The issue is closed.

from bacardi.

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.