Giter Site home page Giter Site logo

Comments (10)

alexnask avatar alexnask commented on July 23, 2024

Just realized this was an issue in magic-lang, not ooc-lang

This can be easily achieved but the bottom line is that such C specific (and in this case, compiler specific) features will probably not make it into ooc-lang, unless there is a project specific modular way of defining modifiers.

from rock.

alexnask avatar alexnask commented on July 23, 2024

@sebastianbaginski

A visibility modifier + flag would be easy, that is.
For a more general solution like a attribute flag used like this: attribute(visibility = default) a little more time would be necessary but it is possible for sure.

Anyway, I have a three day weekend coming up, I'm planning on working on a couple of features so you can probably expect some solution this weekend :)

from rock.

 avatar commented on July 23, 2024

Thanks, great to read that :)
I'm aware that my request is very gcc specific, but I guess that would be enough for us, for a start.
Personally I'd be really happy to see this in ooc, even in the simpler, less general form of a simple visibility flag (but having a deprecated attribute in ooc in the future would be awesome). What do you think @thomasfanell @fredrikbryntesson @marcusnaslund ?

from rock.

marcusnaslund avatar marcusnaslund commented on July 23, 2024

I don't know enough about how we use it, if we want to get "stuck" with gcc-specific stuff, and if it's critical enough to warrant implementing it into the language. @fredrikbryntesson is the boss here.

from rock.

alexnask avatar alexnask commented on July 23, 2024

A deprecated modifier would be useful indeed.

from rock.

 avatar commented on July 23, 2024

@marcusnaslund it does not have to be gcc specific at all, if rock could generate something like this:

/* attributes.h */
#ifdef _WIN32
  #define ATTRIBUTE_VISIBLE __declspec(dllexport)
  #define ATTRIBUTE_HIDDEN
#else
  #ifdef __GNUC__
    #define ATTRIBUTE_VISIBLE __attribute__ ((visibility ("default")))
    #define ATTRIBUTE_HIDDEN  __attribute__ ((visibility ("hidden")))
  #else
    #define ATTRIBUTE_VISIBLE
    #define ATTRIBUTE_HIDDEN
  #endif
#endif

...

/* MyClass.c */
#include <attributes.h>
...
void doSomethingPublic() ATTRIBUTE_VISIBLE;
void _doSomethingPrivate() ATTRIBUTE_HIDDEN;

then it should compile just fine with any C compiler supporting c99, and visibility attributes could simply be ignored if not supported by the compiler.
Of course this is just an idea, I'm sure @Shamanas can figure out something better ;)

from rock.

alexnask avatar alexnask commented on July 23, 2024

@sebastianbaginski

This is still compiler specific (aka non standard C99), which would be a first (I think?) in ooc codegen.
As I said, it would be ideal to have some way to extend modifiers in a project specific manner since this would also enable DLLexport modifiers or other __atrribute__ stuff but I see no elegant way to do this save for mappings in a usefile.

@fasterthanlime
What do you think?

from rock.

fredrikbryntesson avatar fredrikbryntesson commented on July 23, 2024

I am a little skeptical if it is gcc-specific. It is not a bad idea, not at all, but I am worried it will come and bite us later.

from rock.

 avatar commented on July 23, 2024

@thomasfanell @fredrikbryntesson should we close this ? I guess this won't be fixed

from rock.

thomasfanell avatar thomasfanell commented on July 23, 2024

Most likely not.

from rock.

Related Issues (16)

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.