Pages: [1]   Go Down
Author Topic: automatic insertion of closing brace?  (Read 1846 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 296
Got Karma?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

« Last Edit: May 23, 2010, 06:31:03 pm by roypardi » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17262
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley-wink

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

Lefty
Logged

Seattle, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 248
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

.andy

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 296
Got Karma?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


Logged

Wigan, UK
Offline Offline
God Member
*****
Karma: 19
Posts: 814
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Devon, UK
Offline Offline
Full Member
***
Karma: 4
Posts: 234
Arduino rocks my socks, yes the socks are rocking!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 39
Posts: 5557
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: July 11, 2010, 06:15:03 pm by keeper63@cox.net » Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Devon, UK
Offline Offline
Full Member
***
Karma: 4
Posts: 234
Arduino rocks my socks, yes the socks are rocking!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 248
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Of course! She is paying homage to the first woman engineer in history!
Logged

.andy

Wigan, UK
Offline Offline
God Member
*****
Karma: 19
Posts: 814
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: