i propose that Cobra should support inlining with inline keyword
althou small functions are automatically inlined by CLR and c++ inline
is left upto the compiler to decide if atall inlining should be done or not inline is considered a suggestion to compiler that that is what our
intention is
i wish this becomes expicit in cobra by specifying inline that compiler
must inline certain function.it would be further benificiall if sometimes we want that inline function should not be inlined at some place than we could specify there.
def inlinedFun has CobraInlineAttribute
pass
while using/calling
.inlinedFun # gets inlined
.inlinedFun [CobraDontInlineAttribute/keyword/something to enable this feature] #this would not
#inline
or evenbetter
even when one has not applied CobraInlineAttribute to a function
if one would put
.inlinedFun [CobraInlineAttribute/keyword/something to enable this feature] #this should
#inline it right
#there
for instance i as a developer make a function that gives something
like sendName() i am sending the name through this function
when user uses it from my library he should be able to see getName()
because according to him he is Getting the name not sending but i am
sending so it is logicall for me to name it sendName() and logical for
User to see as getName().
althou this example tries to present the essence of what i think
whereas actually one can merely name it as name() but there are other
situations where we are not trying to convey name throught function
if it happens codes of both user and developer would make sense reading
when one wants to comprehend it. it makes the intent clear
Developer writes
--------------
def sendName()
# name is clear what it wants to do
pass
client Uses
-----------
- Code: Select all
Somelibrary.SomeClass.getName()
# makes sense
Somelibrary.SomeClass.SendName()
# does not makesense
so for this a attribute can be made
CobraAliasFuncNameAttribute which applies mutilple times
which might be used like this
- Code: Select all
[CobraAliasFuncNameAttribute(getName)]
[CobraAliasFuncNameAttribute](anynumber of other possibilities..)]
public string sendName()
{
}
whereas at the code generation level cobra could just be passing control to same function like.
- Code: Select all
[CobraAliasOfFunction(sendName)]
public string getName()
{
return sendName()
}
all it does is takes away the load of creating mutiple functions from
user to present his intent and throws on the compiler to generate it
for him.
i hope i have conveyed what i wanted to convey rather than creating
confusion.
with multiple naming and other things many possibilities arise to present
our intent.
THANKING_YOU
RIGHT_THEN