Giter Site home page Giter Site logo

Comments (10)

mttrbrts avatar mttrbrts commented on September 23, 2024 1

I'd argue that this is a bug. We should be creating edges that follow the type hierarchy in the GraphVisitor.

from concerto-codegen.

dselman avatar dselman commented on September 23, 2024

Similar (but different...) would be decorators that referenced types.

from concerto-codegen.

dselman avatar dselman commented on September 23, 2024

Also Map key and value types.

from concerto-codegen.

sanketshevkar avatar sanketshevkar commented on September 23, 2024

I'd argue that this is a bug. We should be creating edges that follow the type hierarchy in the GraphVisitor.

I think I agree with Matt, earlier I thought it could be a addition, but now as I played around it, it feels like a bug.
From the perspective of the mermaid diagram it makes sense and feels like a new addition. But if we want to used the tree shaken model, as given in the example we won't be able instantiate the abstract Pet concept and would need ClassDeclarations for Cat and Dog concepts.

Coming to the point, should we still add the fix as optional? I don't think so. But downside I saw is that after the fix the graph become Directed Cyclic graph, this makes the Flowchart representation a bit clunky.

from concerto-codegen.

sanketshevkar avatar sanketshevkar commented on September 23, 2024

Similar (but different...) would be decorators that referenced types.

Apart from the bug we identified from today's tech-wg call.
I have used the following REPL to describe two scenarios.
Referring to both scenarios, won't having a fully qualified type name be more beneficial in decorator arguments object?
It would be easier to get the derived types especially in cases where we might have similar named types in two different namespaces?

currently:
{ type: 'Identifier', name: 'Color', array: false }
suggested change
{ type: 'Identifier', name: '[email protected]', array: false }

from concerto-codegen.

dselman avatar dselman commented on September 23, 2024

We should make this consistent with what we are doing for other type references, e.g. TypeIdentifier for super class. What does that look like? I also noticed that your code in the REPL seems to be just doing a toString on the object, look at the AST instead, or the API methods.

from concerto-codegen.

sanketshevkar avatar sanketshevkar commented on September 23, 2024

I also noticed that your code in the REPL seems to be just doing a toString on the object, look at the AST instead, or the API methods.

I am bit confused about the toString part

  • I am not explicitly doing any toString, is there implicit call to toString you are referring to?
  • Referring to the AST, this how the arguments object looks like this and even here we don't any reference to the fully qualified type.
"arguments": [
                  {
                    "$class": "[email protected]",
                    "type": {
                      "$class": "[email protected]",
                      "name": "Color"
                    },
                    "isArray": false,
                    "location": {
                      "$class": "[email protected]",
                      "start": {
                        "offset": 117,
                        "line": 9,
                        "column": 17,
                        "$class": "[email protected]"
                      },
                      "end": {
                        "offset": 122,
                        "line": 9,
                        "column": 22,
                        "$class": "[email protected]"
                      }
                    }
                  }
                ]

from concerto-codegen.

sanketshevkar avatar sanketshevkar commented on September 23, 2024

We should make this consistent with what we are doing for other type references, e.g. TypeIdentifier for super class. What does that look like?

In the AST both superType and decorator TypeIdentifiers have a similar shape.

"arguments": [
                  {
                    "$class": "[email protected]",
                    "type": {
                      "$class": "[email protected]",
                      "name": "Color"
                    }, .....
"superType": {
              "$class": "[email protected]",
              "name": "Color"
            }

But for super class when I do
declaration.getSuperClass() I can get a resolved fully qualified type [email protected]

But for reference type decorators I only get [{ type: 'Identifier', name: 'Color', array: false }] when I do decorator.getArguments() , which I don't think is incorrect.

But shouldn't the decorator class have some internal methods that can resolve the type reference, similar to the one we have in classDeclaration ?

from concerto-codegen.

mttrbrts avatar mttrbrts commented on September 23, 2024

But shouldn't the decorator class have some internal methods that can resolve the type reference, similar to the one we have in classDeclaration ?

Yes, you're right, it should. There's a comment in the code that questions this design too!
https://github.com/accordproject/concerto/blob/main/packages/concerto-core/lib/introspect/decorator.js#L80

Can you open an issue for an enhancement to the Introspect API to make it more consistent here, please?

from concerto-codegen.

sanketshevkar avatar sanketshevkar commented on September 23, 2024

accordproject/concerto#797
Added it to v4

from concerto-codegen.

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.