Arduino Forum

Forum 2005-2010 (read only) => General => Uno Punto Zero => Topic started by: roypardi on May 24, 2010, 01:29 am

Title: automatic insertion of closing brace?
Post by: roypardi on May 24, 2010, 01:29 am
Hi all - not sure if suggestions are still being collected but I thought I would suggest another one for the IDE: when an opening brace is inserted, a line space and then a closing brace would automatically be inserted with the correct indentation.


I've been using Eclipse and appreciate this feature there. Unclosed braces for nested conditionals are one of the things I recall getting caught up with when I started out with Arduino and they can be hard to track down since formatting fails with a missing brace.

Appreciate that the IDE is not fully in control of the Arduino project and there are limited resources/lots to do, but this might be relatively easy to implement.

Title: Re: automatic insertion of closing brace?
Post by: retrolefty on May 24, 2010, 02:23 am
I've thought of that feature also, esp when I was first starting out with the Arduino. However I think that learning the harder/manual way is necessary if one really wants to learn the craft of programming. The IDE does have a brace feature of showing what opening or closing brace matches what you have entered so there is a way to keep track and check ones work without having to compile and have to read all the red *hit compiler complaints.  ;)

I recall years ago learning turbo pascal, with all those begin/end errors.  ;D

Lefty
Title: Re: automatic insertion of closing brace?
Post by: ahdavidson on May 24, 2010, 07:29 am
Quote
since formatting fails with a missing brace


This is a key and true point. The formatter often simply crashes on brace mismatch errors, which makes it doubly hard to track down these errors for beginners.
Title: Re: automatic insertion of closing brace?
Post by: Osgeld on May 24, 2010, 05:15 pm
Quote
would automatically be inserted with the correct indentation.


what is considered "correct", 1 tab? what if your in a block already does it default to 2, or 3 etc
Title: Re: automatic insertion of closing brace?
Post by: roypardi on May 25, 2010, 12:04 am
Quote

what is considered "correct"

That could probably be sorted out based on the position of the  opening brace.

Quote
I think that learning the harder/manual way is necessary if one really wants to learn the craft of programming.

I don't agree with the "tough love" approach to programming (i.e. not providing this sort of assist) since the whole point of Arduino is making physical computing (and the programming behind it) more accessible to a wide range of people.


Title: Re: automatic insertion of closing brace?
Post by: cowjam on Jun 08, 2010, 10:40 am
Lefty, Turbo Pascal told you exactly where the fault was, or at least it did in Borland's lovely DOS based programming environment. There's learning the hard way and there's looking for a needle in a haystack.

Title: Re: automatic insertion of closing brace?
Post by: graymalkin on Jul 12, 2010, 12:41 am
Hard way of programming?! we have it easy, with the wide range of C based IDEs (most work with arduino) what about those poor saps who use PICs they are stuck with ASM and BASIC, either crazy nutter I'm the most hardcore programmer there is or, 123 my first program.
Title: Re: automatic insertion of closing brace?
Post by: cr0sh on Jul 12, 2010, 01:14 am
Quote
what about those poor saps who use PICs they are stuck with ASM and BASIC


Don't knock it 'til you've tried it, kid. One of the greatest learning experiences you can have as a coder is bare-metal hex-editing or other similar hand-assembly. You'll learn a lot, and it makes you really appreciate what we have available today.

But even that isn't hardcore.

Know who Charles Babbage is? Then you should know who the first computer hacker was. She was Babbage's protégé, and helped to explain to others exactly how his proposed Analytical Engine was to work. She wrote its first programs, in its assembler mneumonics. She had no hardware to test it with. Years later it was found that, using emulators, her programs worked. She predicted the use of computers to play chess, compose music, along with a variety of other tasks. She postulated on the idea of programming a computer to think like a human (AI). Sadly, she died young (and painfully) of cancer.

Her name was Lady Ada Lovelace.

That's hardcore.
Title: Re: automatic insertion of closing brace?
Post by: graymalkin on Jul 12, 2010, 01:42 am
Oh, I have tried it, and it is fun, but one of the hardest ways to make an LED blink I can think of. That may be due to lack of experience though.  Also, interesting that Lady Ada of Ada fruit uses that name, is this the reason why :O
Title: Re: automatic insertion of closing brace?
Post by: ahdavidson on Jul 12, 2010, 02:38 am
Of course! She is paying homage to the first woman engineer in history!
Title: Re: automatic insertion of closing brace?
Post by: cowjam on Jul 12, 2010, 04:00 pm
Quote
Also, interesting that Lady Ada of Ada fruit uses that name, is this the reason why


I'd presumed the site was named after the first programmer, I hadn't even contemplated that there was one real female behind it.
Title: Re: automatic insertion of closing brace?
Post by: bmorgan on Jul 19, 2010, 01:57 am
Quote
She wrote its first programs, in its assembler mneumonics (sic)...  Sadly, she died young (and painfully) of cancer.
coding in assembler may have been a factor

It's fine if you want to delve in the nitty gritties, but my guess is that most here want to see their projects work without knowing the course of every bit and unnecessary debugging.