Page 1 of 1

A couple of suggestions

PostPosted: Tue Oct 11, 2011 7:07 pm
by Stugol
Hi. Let me say first that I really like this language. It has the advantages of Python while being, to my mind, cleaner and more usable.

I currently code mainly in VB.NET (with a little C++ and C# when appropriate), but I'd like to use Cobra for some of my own future projects. At the moment, however, I am hampered by a couple of issues.

Firstly, and most importantly, IDE support is practically non-existent. I have installed the Visual Studio add-in, and also (after much head-scratching) managed to compile and run Visual Cobra Express. However, neither of these IDEs seem to achieve much. Express, for instance, is mostly non-functional in any case. File->New->Project does nothing(!) and there is no way in either IDE to "save, compile and run" in one click or keypress. Further, intellisense (which nowadays is an expected feature of any language) is completely absent.

In short, we have nothing more than a text editor with syntax highlighting, making writing Cobra code a painful and tedious process. And that's a shame, because it's obviously an elegant and well-thought-out language; it's just being held back by these deficiencies. I mean, without proper IDE support, how many people will honestly take Cobra seriously? The notion of writing a complete application in what is - essentially - little better than Notepad makes me want to run away and hide underneath something.

Secondly, I'm concerned about the dot-prefix notation for accessing member functions and variables. It's very easy - indeed, it happened to me - to create a local variable when you really meant to access a class member. Took me 10 minutes to track the bugger down, and all because I'd missed a dot, which the compiler didn't catch. Perhaps the solution here is to implement something like VB's "Option Explicit" - that is, all variables must be declared with var before they can be used. It'd catch a lot of bugs at compile-time, which is why the option has existed in VB for over a decade.

I would like to help - either with the language design, with the IDE support, or both. I haven't had much experience with either, but I'm pretty good at coding in general, and I'm willing to learn.

Re: A couple of suggestions

PostPosted: Wed Oct 12, 2011 10:04 am
by Charles
Stugol wrote:I would like to help - either with the language design, with the IDE support, or both. I haven't had much experience with either, but I'm pretty good at coding in general, and I'm willing to learn.

I agree with your thoughts on the IDE support. Therefore, this would be the ideal area to contribute to. While there are always outstanding ideas and TO-DOs on the compiler, the fact is that from a pure language perspective, Cobra is usable now.

Regarding your 2nd point regarding dotted notation, this has not been widely reported. It might just be something that you get used to and then don't have to think about further. Also, if you can provide some sample code, we can think about cooking up a better error message. If you wrote "foo = 5" and meant ".foo = 5", didn't you get a warning that "foo" was unused?

Thanks for taking the time to provide feedback and offering to help.

Re: A couple of suggestions

PostPosted: Wed Oct 12, 2011 1:37 pm
by torial
Stugol wrote:Firstly, and most importantly, IDE support is practically non-existent.


That is true, most IDE attempts have stalled. The Visual Studio integration stalled. And I and another guy were working on separate IDEs and we both got sidetracked. For my part, if you'd like to contribute to Naja (http://cobraide.codeplex.com/) I'd be happy for the help at this point. I've had a very busy year, with barely any personal time to advance Naja much.

Re: A couple of suggestions

PostPosted: Wed Oct 12, 2011 1:39 pm
by torial
Also, you might want to try the Sharp Develop plugin. I'm not sure what state it is in, but the feature list is pretty good.

http://cobrapluginsd.codeplex.com/

Re: A couple of suggestions

PostPosted: Tue Oct 18, 2011 12:31 pm
by Stugol
Charles wrote:If you wrote "foo = 5" and meant ".foo = 5", didn't you get a warning that "foo" was unused?

Yes I did, but didn't immediately realise that it really meant "you have forgotten a leading dot on foo". I mean, I'm used to coding in VB.NET and it often complains that stuff is "unused", simply because I haven't written the bit that uses it yet. Like, suppose I know I'm going to need a TextReader or something. So I create one in the class, but haven't written any functions yet that make use of it. So I get this warning.

In other words, "<blank> is unused" is a warning that VB and C# programmers simply don't notice anymore. It's like "ByVal" in parameter lists - I had forgotten it even existed until VS2010SP1 removed it.

When I write code, I always set Option Explicit - meaning, of course, that I can't use a variable unless I declare it. This catches loads of mistakes at compile-time. I really do recommend you implement such a feature. It doesn't have to be the default behaviour - just add an #Explicit keyword at the top of the code or something.

torial wrote:That is true, most IDE attempts have stalled. The Visual Studio integration stalled. And I and another guy were working on separate IDEs and we both got sidetracked. For my part, if you'd like to contribute to Naja (http://cobraide.codeplex.com/) I'd be happy for the help at this point. I've had a very busy year, with barely any personal time to advance Naja much.

I'd be happy to contribute, but I'd need some help with language parsing (for writing a standalone IDE) or extending Visual Studio (if writing an extension). Naja looks promising, but it could use a number of improvements and bug fixes. Could you explain to me how Naja parses (and syntax highlights) the language? That's the difficult part, to my mind. If I could do that, I could write a new editor quite quickly, I reckon. I mean, let's face it, Naja isn't exactly a full-featured IDE, now is it? I mean no disrespect, but it's fairly basic. The only ways in which it differs from a text editor are [a] syntax highlighting, [b] a "compile" menu (which isn't exactly difficult), and [c] a solution explorer.

Re: A couple of suggestions

PostPosted: Mon Oct 24, 2011 9:45 am
by torial
Stugol wrote:
torial wrote:That is true, most IDE attempts have stalled. The Visual Studio integration stalled. And I and another guy were working on separate IDEs and we both got sidetracked. For my part, if you'd like to contribute to Naja (http://cobraide.codeplex.com/) I'd be happy for the help at this point. I've had a very busy year, with barely any personal time to advance Naja much.

I'd be happy to contribute, but I'd need some help with language parsing (for writing a standalone IDE) or extending Visual Studio (if writing an extension). Naja looks promising, but it could use a number of improvements and bug fixes. Could you explain to me how Naja parses (and syntax highlights) the language? That's the difficult part, to my mind. If I could do that, I could write a new editor quite quickly, I reckon. I mean, let's face it, Naja isn't exactly a full-featured IDE, now is it? I mean no disrespect, but it's fairly basic. The only ways in which it differs from a text editor are [a] syntax highlighting, [b] a "compile" menu (which isn't exactly difficult), and [c] a solution explorer.


Naja could definitely use some bug fixes and improvements, but I did have a staged release plan (alas without the time to pursue it) which would have gotten it to the more IDE-like state you desire. I may get to work on it a little in the next month or two (depending on how some work tasks fall I may get to play with Cobra for work). The Naja syntax parsing isn't too smart, because I've offloaded the bulk of the work to the Sharp Develop editor control, using the config file from the SharpDevelop plugin. The most parsing I did was w/ the folding, and to be honest, can't remember the mechanism I used, just that it wasn't perfect (it failed to come up w/ a fold line for the last line if memory serves). You are forgetting: a) the experimental UI designer, which is one-way, admittedly glitchy, but useful for making UI forms w/o handcoding all the UI code, b) the Todo list (which may not matter much to you, but I find useful). Other than that, I do agree it is pretty simple at this point. I did more work on it than the releases/features may hint, as I spent some time looking into the managed debugger from MS, and how to control that, as well as on some of the UI designer logic, making a test runner for the cobra unit tests, and also exploring a different editor control.

Btw, regarding VB.Net, not sure if you've explored using Option Strict, but I've found that when I forced code into that state (w/ the requisite code changes) I was able to get good performance improvements w/ the VB.Net fxns. Might be worth trying for any logic that runs in a tight loop and you are contemplating porting it to some other language for perf reasons.

Re: A couple of suggestions

PostPosted: Mon Oct 24, 2011 10:41 am
by Stugol
torial wrote:The Naja syntax parsing isn't too smart, because I've offloaded the bulk of the work to the Sharp Develop editor control, using the config file from the SharpDevelop plugin. The most parsing I did was w/ the folding, and to be honest, can't remember the mechanism I used, just that it wasn't perfect (it failed to come up w/ a fold line for the last line if memory serves).

Yeah, syntax highlighting is always a pain. I tried implementing it myself once, and it was slow as all hell. I wonder how M$ manage it.

torial wrote:You are forgetting: a) the experimental UI designer, which is one-way, admittedly glitchy, but useful for making UI forms w/o handcoding all the UI code,

Yes, I had noticed the option, but ignored it because a one-way GUI designer is totally useless to me. I often need to make radical changes to my UIs.

torial wrote:b) the Todo list (which may not matter much to you, but I find useful).

Mmm. Never really used TODOs much in Visual Studio either, to be honest.

torial wrote:I spent some time looking into the managed debugger from MS, and how to control that, as well as on some of the UI designer logic, making a test runner for the cobra unit tests, and also exploring a different editor control.

I think those are the most important issues. I could throw a simple IDE together in an afternoon except for the syntax highlighting and debugging. Those are the big sticking points. Do you have any ideas for improving the highlighting? Has anyone released any good controls recently for the purpose, do you know?

torial wrote:Btw, regarding VB.Net, not sure if you've explored using Option Strict, but I've found that when I forced code into that state (w/ the requisite code changes) I was able to get good performance improvements w/ the VB.Net fxns. Might be worth trying for any logic that runs in a tight loop and you are contemplating porting it to some other language for perf reasons.

Oh, I always use Option Strict, Option Explicit and Option Compare Text in every file I write.

Re: A couple of suggestions

PostPosted: Mon Oct 24, 2011 10:46 am
by torial
Stugol wrote:
torial wrote:I spent some time looking into the managed debugger from MS, and how to control that, as well as on some of the UI designer logic, making a test runner for the cobra unit tests, and also exploring a different editor control.

I think those are the most important issues. I could throw a simple IDE together in an afternoon except for the syntax highlighting and debugging. Those are the big sticking points. Do you have any ideas for improving the highlighting? Has anyone released any good controls recently for the purpose, do you know?


You might want to take a look at http://www.codeproject.com/KB/edit/Fast ... tBox_.aspx (which is LGPL, btw)