Comments (10)
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.
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.
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.
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.
A deprecated
modifier would be useful indeed.
from rock.
@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.
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.
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.
@thomasfanell @fredrikbryntesson should we close this ? I guess this won't be fixed
from rock.
Most likely not.
from rock.
Related Issues (16)
- update readme for windows with new repository path HOT 1
- Generic values are allocated on the stack during construction HOT 13
- Print rock version in preamble HOT 4
- Method call on tuple may cause rock to throw an exception
- Replace this with self (or similar) in generated C code? HOT 1
- [Feature] Generic (interface) constraints HOT 3
- Add count property/variable/method on enums HOT 23
- Adding enum elements to a List HOT 4
- Failure when trying to pass bracket operator as argument to a callback function in generic class HOT 2
- Obfuscator problem HOT 15
- Can we export unmangled global variables ? HOT 3
- Global variables defined inside a version block are local to the module load function
- Support wildcard matching in obfuscator rules ? HOT 1
- Is operator `as` unreliable when testing for inheritance ? HOT 6
- Where is the updated sdk source? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rock.