Giter Club home page Giter Club logo

Comments (5)

Mi-La avatar Mi-La commented on May 28, 2024

The idea is good, but we should solve syntax and wrong usage:

Possible syntaxes:

  1. root struct Root { ... };
  2. struct root Root { ... };
  3. main struct Root { ... };
  4. struct main Root { ... };
  5. rootstruct Root { ... };
  6. mainstruct Root { ... };
  7. root Root;
    struct Root { ... };
  8. main Root;
    struct Root { ... };
  9. struct Root^ { ... };

Wrong usage:

root struct MarkedRoot
{
    uint32 value;
};

struct Structure
{
    MarkedRoot markedRoot; // marked root is used, what to do? warning?!
}

from zserio.

fklebert avatar fklebert commented on May 28, 2024

Initial idea was to use something like

root struct Element1
{}

The above would not throw the warning for unused element. But the element itself could of course be reused by other structs. So basically there would be no "wrong usage" at all.

from zserio.

Mi-La avatar Mi-La commented on May 28, 2024

We think that the root keyword isn't consistent enough. For example, it seems very strange to have root const string ID = "Zserio", or root subtype int32 MySubtype. And also for users it might be difficult to keep in mind which entities can be "root" - e.g. sql_database or service are always "root".

Therefore we propose to introduce new command line option -> -withUnusedWarnings / -withoutUnusedWarnings(default). Then the user can just run the tool with -withUnusedWarnings to check which types are not used. In future, we could add something like "unusedWarningsBlackList" to suppress the warning for types which are supposed to be "root". This solution will not do mess in the language.

from zserio.

fklebert avatar fklebert commented on May 28, 2024

OK, I agree. So the default would be that the tool does not provide the unused warnings. Only if you explicitly turn it on. Sounds good!

from zserio.

Mi-La avatar Mi-La commented on May 28, 2024

yes, by default you get no unused warnings

from zserio.

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.