An example compiler directive would be conditional compilation like C#'s "#if"
Another use would be to put cobra arguments at the top of a file.
But what should they look like? I don't want to double up any arithmetic operators since Cobra already does that for ** and // which are themselves arithmetic operators. @ and $ are reserved for future use. I don't think # is suitable as it's being used for comments.
I have some ideas, but I'd like to hear yours.
Forums
Soliciting feedback on compiler directives
5 posts
• Page 1 of 1
Re: Soliciting feedback on compiler directives
How about a keyword instead of a special character?
The idea is that you're speaking to the compiler.
* for conditional compilation the "cobra" keyword would be indented at the level of the surrounding code and the result of satisfying the condition would then be returned at that level
cobra args -one-option -another
cobra if somecondition
cobra dosomething #nested compiler directive, e.g. to set an option
dosomemore #this gets compiled (deducting one indentation level*)
cobra else
dosomethingelse
The idea is that you're speaking to the compiler.
* for conditional compilation the "cobra" keyword would be indented at the level of the surrounding code and the result of satisfying the condition would then be returned at that level
- dennis
- Posts: 21
Re: Soliciting feedback on compiler directives
dennis wrote:How about a keyword instead of a special character?cobra args -one-option -another
cobra if somecondition
cobra dosomething #nested compiler directive, e.g. to set an option
dosomemore #this gets compiled (deducting one indentation level*)
cobra else
dosomethingelse
I like this idea... Chuck, finally what was your decision on this regard?
- jonathandavid
- Posts: 159
Re: Soliciting feedback on compiler directives
I'm no longer reserving @ for other usage. So I'm currently leaning towards @foo as in @if, @args, etc.
I had thought of the "cobra foo" idea myself at an earlier time, and it's quite logical, but it just doesn't stand out from the rest of the code. Also @foo could be useful within a line of code like @show(foo.bar.baz) expanding to:
'foo.bar.baz=[CobraCore.toTechString(foo.bar.baz)]'
I had thought of the "cobra foo" idea myself at an earlier time, and it's quite logical, but it just doesn't stand out from the rest of the code. Also @foo could be useful within a line of code like @show(foo.bar.baz) expanding to:
'foo.bar.baz=[CobraCore.toTechString(foo.bar.baz)]'
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Soliciting feedback on compiler directives
FWIW I'm comfortable with the existing '%%' prefix at start of line
It stands out strongly from executable code and being wired to the start of line its not mistakeable for any sort of arithmetic operator.
- Code: Select all
%% warning pull up whoop whoop
%% number float32
%% args -ref:myLibNamedFunny
It stands out strongly from executable code and being wired to the start of line its not mistakeable for any sort of arithmetic operator.
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 47 guests