Can older deprecation alerts be switched back on for the log
Moderators: winston, another_commander, Getafix
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
Can older deprecation alerts be switched back on for the log
I guess this is a question for the devs ...
Can older deprecation alerts be switched back on for the error log? I mean, anything that has been deprecated in 1.75.1 since 1.70 upwards?
It would be very useful if that was possible - thanks in advance for any useful answer.
Can older deprecation alerts be switched back on for the error log? I mean, anything that has been deprecated in 1.75.1 since 1.70 upwards?
It would be very useful if that was possible - thanks in advance for any useful answer.
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: Can older deprecation alerts be switched back on for the
All previously deprecated JavaScript functionality has been completely removed. Many of the compatibility shims were implemented in JavaScript, and you could find them by digging through the revision history of oolite-global-prefix.js. The old implementations might not work in 1.75.1, though.
E-mail: [email protected]
Re: Can older deprecation alerts be switched back on for the
Ugh, the cull has been impressive, the best thing to do is to feed us a list of the various errors you have on the log - maybe in small doses, to avoid overwhelming us - and we should be able to give you the MNSR equivalents without too much trouble.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Can older deprecation alerts be switched back on for the
Or look them up in the documentation. In most cases it's fairly evident what the new name of a method or property is.Kaks wrote:Ugh, the cull has been impressive, the best thing to do is to feed us a list of the various errors you have on the log - maybe in small doses, to avoid overwhelming us - and we should be able to give you the MNSR equivalents without too much trouble.
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
Re: Can older deprecation alerts be switched back on for the
Thanks all for the answers ... yes, that would be very nice, will see to it that I feed in small dosesKaks wrote:Ugh, the cull has been impressive, the best thing to do is to feed us a list of the various errors you have on the log - maybe in small doses, to avoid overwhelming us - and we should be able to give you the MNSR equivalents without too much trouble.
My problem lies less with changing to the newer and actualised equivalents, I was more wondering if I could get the older deprecations written to the log at all - the way I understand it, things that were deprecated after 1.73 gave a warning in the 1.74 log but will no longer show up as deprecation warning in a 1.75 log - or am I mistaken there?
And I would like to be alerted about any and all deprecations as far back as 1.70, if at all possible.
As to how to change deprecations then ...
... this.Commander McLane wrote:look them up in the documentation. In most cases it's fairly evident what the new name of a method or property is.
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: Can older deprecation alerts be switched back on for the
It depends. If you try to call a non-existent method, likeLestradae wrote:My problem lies less with changing to the newer and actualised equivalents, I was more wondering if I could get the older deprecations written to the log at all - the way I understand it, things that were deprecated after 1.73 gave a warning in the 1.74 log but will no longer show up as deprecation warning in a 1.75 log - or am I mistaken there?
player.ship.wibble()
, you’ll get an error. If you try to define an obsolete event handler, you won’t, because you can create properties with just about any name you want.E-mail: [email protected]
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Can older deprecation alerts be switched back on for the
For event handler you could sort of test them by inserting a log line into each of them.
Say you have something like
and are not certain if it's still working (in this case it isn't).
Then just insert a log message
and make a ship with this script destroy a target. If you get
in your log, the handler has fired correctly. If you don't, it hasn't.
(The example
Or you go through all release notes since whenever you stopped developing your OXPs. All release notes list which old event handlers got replaced with which new handlers. Then you can open your script and perform a find&replace for one after the other. Perhaps this would be the most efficient method.
Say you have something like
Code: Select all
this.shipDestroyedTarget = function(target)
{
// do stuff
}
Then just insert a log message
Code: Select all
this.shipDestroyedTarget = function(target)
{
log("test", "shipDestroyedTarget is working");
// do stuff
}
Code: Select all
shipDestroyedTarget is working
(The example
shipDestroyedTarget
was actually replaced. Looking it up in the Wiki you see that there is now a handler named shipTargetDestroyed
, which is the same thing with a new name.)Or you go through all release notes since whenever you stopped developing your OXPs. All release notes list which old event handlers got replaced with which new handlers. Then you can open your script and perform a find&replace for one after the other. Perhaps this would be the most efficient method.
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
Re: Can older deprecation alerts be switched back on for the
Both (McLane) suggestions are good and after I read what Ahruman had to say probably this ...
I hoped the old deprecation alerts could perhaps somehow be switched back on, that would have been easier & faster on me - but meh, I'll do as suggested.
Cheers & thanks for the help
L
... is going to be my strategy.Commander McLane wrote:Or you go through all release notes since whenever you stopped developing your OXPs. All release notes list which old event handlers got replaced with which new handlers. Then you can open your script and perform a find&replace for one after the other. Perhaps this would be the most efficient method.
I hoped the old deprecation alerts could perhaps somehow be switched back on, that would have been easier & faster on me - but meh, I'll do as suggested.
Cheers & thanks for the help
L
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: Can older deprecation alerts be switched back on for the
This script will notify you of deprecated event handlers. You’ll need to fill in the list yourself, though.
Code: Select all
"use strict";
this.name = "deprecation-warnings";
(function() {
const deprecated =
{
deprecatedEvent: "newEvent",
deprecatedEvent2: "newEvent2"
};
for (var deprecatedName in deprecated)
{
if (deprecated.hasOwnProperty(deprecatedName))
{
var newName = deprecated[deprecatedName];
createDeprecationHandler(deprecatedName, newName);
}
}
function createDeprecationHandler(deprecatedName, newName)
{
Object.defineProperty(Script.prototype, deprecatedName,
{
get: function () { return this[newName]; },
set: function (value)
{
log("js.deprecated", "Event handler " + deprecatedName + " is deprecated. Use " + newName + " instead.");
this[newName] = value;
}
});
}
})();
E-mail: [email protected]
Re: Can older deprecation alerts be switched back on for the
How about installing old versions of Oolite on memory sticks or something similar. Not the ideal solution, but should be feasible if there are specific errors messages you are looking for.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
(Gold Medal Award, Zzap!64 May 1985).