Closed felixangell closed 8 years ago
I am not sure about the maybe
value for the inline attribute. What about using hint
since it describes its functionality better.
From LLVM's reference (http://llvm.org/docs/LangRef.html#function-attributes):
inlinehint: This attribute indicates that the source code contained a hint that inlining this function is desirable (such as the “inline” keyword in C/C++). It is just a hint; it imposes no requirements on the inliner.
(from https://github.com/ark-lang/ark/pull/644#issuecomment-174019805)
@Acconut :+1: on hint
over maybe
:)
The target* and exclude* attributes are a bit restrictive by design in my mind. For example, how would you include a function on linux
and darwin
?
It would be cool to have something like [include(os="linux" || os="darwin")]
although that is quite though and somewhat an overkill for now. :)
I could be wrong here, but depending how it's implemented you might be able to add multiple include_os
attributes and it would work as expected. Though, I quite like the idea of having the ORs/ANDs (and other operations?) for some basic logic when it comes to the attributes.
IMO I don't believe logic belongs in attributes, multiple attributes should work fine.
AFAIK mutliple attributes are not allowed ATM since they are stored in a simple map: https://github.com/ark-lang/ark/blob/master/src/parser/attr.go#L19
Maybe the function etc. including and excluding should be implemented using macros, once they are shipped. I guess, this enables more flexibility while keeping attributes simple (as @raoulvdberge mentions) and does not require to implement the attributes for every possible declaration type.
We'll definitively want a better way than attributes to handle ex-/including code from certain archs/OSs
Closing this and making a separate issue for target-conditional compilation.
Blocked by #577 ??
A modifier for exporting functions should be introduced, e.g:
Also, a way of specifying call convention via attributes, e.g:
UPDATE: also the attributes from #513
and the options: