Go Down

Topic: I think deleting WProgram.h was a bad idea (Read 2898 times) previous topic - next topic

Jantje

Hi
I wonder why WProgram.h got deleted. Wasn't it a better idea to replace the content with #include "arduino.h" and a #warning "This file has been deprecated"?
This way developers get the time to update the code.
I know Arduino doesn't show warnings but still...;

Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

robtillaart

Quote
This way developers get the time to update the code.


Think this way the developers learn to read the release notes ;)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

James C4S

No matter how long you provide legacy support, eventually things will break.  1.0 is a clearcut place to make some difficult decisions. 

The developers have been very clear that WProgram.h was going away.  So in essence, the "break-in" period should already be over.  Nobody should have been surprised when 1.0 came out yesterday.  It has been known for months this change was coming.

Whether it changed yesterday or 5 years from now, someone would make the pointless case that "this was a bad time to change it."  Yes, anytime you make a change like that, it is a bad time.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Jantje

James
I didn't make a case about bad timing. So for sure: "I didn't make a pointless case on bad timing". Please don't insinuate I'm a loser who doesn't get the full picture.

My case is that there is no transition period. Anyone who build a tool upon the Arduino library could not do changes before 1.0 was out and has to make changes to the tool and to the code after 1.0 comes out.
The workload could have been "sugarcoated" with some backwards compatibility measurements.
The tone of your mail continues in this trend.

Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

WizenedEE

like
Code: [Select]

#if ARDUINO >= 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif


?

Paul Stoffregen

I personally didn't like the decision to completely remove WProgram.h.  It's easy to keep a WProgram.h which merely includes Arduino.h.  I've done this and much more in my support for Teensy (see below).  Ideally, a warning would be printed if WProgram.h is used, but that's not so easy since gcc is run with "-w", so #warning does not work in Arduino.

Clearly keeping a WProgram.h was considered:

http://code.google.com/p/arduino/issues/detail?id=609

I think a bigger problem is that the 4 beta tests and 2 release candidates were never widely available.  Unless you follow the developer mail list, which is often has a high ratio of chatter about coding philosophy to actual people working on real code, you probably never would have known about these 6 releases over the last several months.  Their purpose was to give people time to adapt to 1.0's changes.  But not showing them on the main download page kept them in relative obscurity.

Then again, I've exchanged messages with several library authors over the last year.  The general sentiment was to not worry about porting to 1.0 until it was official.  So perhaps no amount of pre-release access would have helped?

In Teensyduino, I added as much backwards compatibility as possible.  Both WProgram.h and Arduino.h work in both 0023 and 1.0.  print(n, BYTE), Wire's original functions, and many other little things all work perfectly in 1.0.  At least they do on Teensy, where I can publish an alternate core.  I have no control over Arduino.  Even the patches I contribute only seem to get used when they're small bug fixes.

Another very unfortunate issue (which was reported to me only yesterday... I working on a fix now) involves the naming of Udp in Arduino 1.0.  If you try to make a core library that is compatible with both new and old sketches and libraries (maybe I'm the only person crazy enough to attempt that?), the fact that these headers with the same names as 0023's ethernet library are now part of the core library is a major headache.  There does not seem to be any solution using only the compiler's preprocessor, because of the way the include paths are built.  My next update to the Teensyduino installer will include a check for these when installing on 0022 or 0023.

If there's interest from the Arduino Team to provide backwards compatibility with 0023 in the next release, I will certainly contribute patches.  I've already solved almost all the compatibility issues that prevent code designed for 0023 from working on 1.0.  I've also managed to back-port nearly all 1.0 features to 0023.  It's really not that difficult... if you care about preserving compatibility.

Of course, there are a couple 0023->1.0 compatibility issues are impossible by design, like the intentionally different function of Serial.flush() and Serial.print() using unsigned char printing as base 10 number instead of a single byte.

Nick Gammon


Think this way the developers learn to read the release notes ;)


Hmmm. Maybe I should read them. The first one brought a smile:

Quote
The file extension for sketches has changed from .pde to .ino ...


A fair bit of file renaming ahead for me, when I download version 1.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

robtillaart

Quote
A fair bit of file renaming ahead for me, when I download version 1.


Or associate .pde to version1.exe - at least on windows that might be a possible workaround, old code just .pde, new sketches .ino ?  (not tried )
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

The Ultrasonic library has not been updated from ITead Studio and still has the line: #include "WProgram.h"
This results in an error and the sketch will not compile. I left a comment on http://iteadstudio.com/application-note/arduino-library-for-ultrasonic-ranging-module-hc-sr04/  We shall see how long it takes them to issue a new library.

Any suggestions for workarounds?
Thanks,
Tom

Nick Gammon

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

zoomkat

A link with some 1.0 info.

http://blog.makezine.com/archive/2011/12/arduino-1-0-is-out-heres-what-you-need-to-know.html
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Go Up