Reduce deprecated script warning text

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Reduce deprecated script warning text

Postby Major Cooke » Tue Aug 13, 2019 6:03 pm

I would like to suggest that warnings like this:

Code: Select allExpand view
Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Call to deprecated function CharAt
Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Accessing deprecated function CharAt - deprecated since 4.1.0


...be squished down to:

Code: Select allExpand view
Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Accessing deprecated function CharAt - deprecated since 4.1.0


When there's a lot to read, that's a lot of needless text being duplicated, especially the "script warning" lines being needlessly duplicated.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Reduce deprecated script warning text

Postby Nash » Tue Aug 13, 2019 6:59 pm

On a related note, would it be possible to suggest what to replace the deprecated function with, so that people can stop making forum posts asking "what should I use in place of CharAt"? :P
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Reduce deprecated script warning text

Postby Major Cooke » Wed Aug 14, 2019 7:09 am

I don't think that should be too hard, if the deprecated function is expanded to include an extra parameter.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Reduce deprecated script warning text

Postby phantombeta » Wed Aug 14, 2019 12:24 pm

Major Cooke wrote:I don't think that should be too hard, if the deprecated function is expanded to include an extra parameter.

It's not a function, it's an attribute. And ZScript's attributes are built into the ZScript parser. So, uh... Good luck. This is coming from someone who worked on the JIT and made several PRs for the ZScript compiler.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_
Github ID: Doom2fan
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Reduce deprecated script warning text

Postby Graf Zahl » Wed Aug 14, 2019 12:35 pm

You'd have to make a change to the grammar but this won't have to filter down to the JIT, the message should be emitted in the resolving pass.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Reduce deprecated script warning text

Postby phantombeta » Wed Aug 14, 2019 12:40 pm

Graf Zahl wrote:You'd have to make a change to the grammar but this won't have to filter down to the JIT, the message should be emitted in the resolving pass.

???
I never said it would affect the JIT, I was saying it would be a pain in the ass, because the lemon and the parser are ass.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_
Github ID: Doom2fan
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Reduce deprecated script warning text

Postby Graf Zahl » Wed Aug 14, 2019 12:44 pm

Code: Select allExpand view
decl_flags(X) ::= decl_flags(F) DEPRECATED(B) LPAREN STRCONST(A) COMMA STRCONST(C) RPAREN.   
{
   if (F == nullptr)
   {
      NEW_AST_NODE(DeclFlags,nil_f,B.SourceLoc);
      X = nil_f;
      X->Flags = ZCC_Deprecated;
      X->Id = nullptr;
      X->Version = { 0, 0 };
   }
   else
   {
      X = F;
      X->Flags |= ZCC_Deprecated;
   }
   X->Version = A.String->GetChars();
   // Do something with C here.
}


That's all you need in the parser.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Reduce deprecated script warning text

Postby _mental_ » Wed Aug 28, 2019 5:17 am

Doubling of depreciation warnings was fixed some time ago.

For optional depreciation messages, I made this PR. It doesn’t contain any messages, fill free to make PRs with then (if this change will be merged of course).
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Reduce deprecated script warning text

Postby Graf Zahl » Wed Aug 28, 2019 6:38 am

Merged. The last point about adding messages still stands, of course.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Reduce deprecated script warning text

Postby Nash » Wed Aug 28, 2019 6:46 am

Thanks _mental_! I'll try and add some message PRs as soon as I'm able (expect at least one more question thread about deprecated function replacements :P)
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Reduce deprecated script warning text

Postby Rachael » Wed Aug 28, 2019 8:49 am

If possible, I think the deprecation notices should suggest new functions for you to use. Of course, that requires contextually handling every deprecation, and that might be a bit messy... but it would still be really helpful.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest