Deprecated commands

Everything else that doesn't fall into one of the other PB categories.
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Deprecated commands

Post by MachineCode »

PureBasic Manual wrote:Warning
This function is deprecated, it may be removed in a future version of PureBasic. It should not be used in newly written code.
I think it's confusing to support deprecated commands. Just remove them and let the coder deal with any error messages. You're just making extra work for yourself for nothing. Don't hold the coder's hand all the time for basic errors like this. IMO. :?
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Deprecated commands

Post by c4s »

Isn't it new that the deprecated functions are listed in the help file?
I think it's a very good idea to do so because there are often questions from newbies like "what means the CreateGadgetList() warning" etc. - This way it's a lot easier to find the new function name.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Deprecated commands

Post by luis »

c4s wrote:Isn't it new that the deprecated functions are listed in the help file?
I saw them only in the history, some times I looked for them using "Find" in that list.

Personally I find the "deprecated" message a good thing. Gives the time to update your program later and still enable you to to use the features of a latest version. You are warned, don't count on this forever and plan to update it, but you are not requested to do it immediately.
"Have you tried turning it off and on again ?"
freak
PureBasic Team
PureBasic Team
Posts: 5962
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Deprecated commands

Post by freak »

The deprecated commands are not for existing users, but for new ones. If they copy a code with a non-existing function from the forum they won't know what to do if the message is just "function does not exist". Not everybody knows the PB history by heart and knows which functions have been removed and why.

> Isn't it new that the deprecated functions are listed in the help file?

Yes its new. The idea is to give enough information on where to look for a replacement for such a function, but no further information on the deprecated function itself so people are not tempted to keep using it in new code.
quidquid Latine dictum sit altum videtur
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6175
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Deprecated commands

Post by blueznl »

I like the message. If I use one of my older include files and I have not yet done an update I get a warning, so I have some time to take care of matters and no ugly surprises...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Michael Vogel
Addict
Addict
Posts: 2867
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Deprecated commands

Post by Michael Vogel »

The message is helpful, an additional [Repair] button/popup which converts the given line to the actual syntax would be perfect :lol:
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6175
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Deprecated commands

Post by blueznl »

Perhaps it would make sense to add a link into the help file detailing the replacement comment, wouldn't it?

In fact, come to think of it, it would also simplify many issues with old code... If the compiler encounters a discarded keyword, throw an error, pop up the requester, and show a hotlink into the help file to the replacement or some related code. If the compiler encounters a deprecated command, still pop up the warning but keep compiling. For all practical purposes, it's little more than a two column list, isn't is?

Effectively, if a user would try to run (copy / paste) some old code, he / she would at least have some clue where to go or what to look for.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Deprecated commands

Post by c4s »

blueznl wrote:Perhaps it would make sense to add a link into the help file detailing the replacement comment, wouldn't it?
E.g. CountList() says: "This function has been replaced by ListSize(). Use that instead." I'd say that's enough.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Zach
Addict
Addict
Posts: 1678
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Deprecated commands

Post by Zach »

c4s wrote:
blueznl wrote:Perhaps it would make sense to add a link into the help file detailing the replacement comment, wouldn't it?
E.g. CountList() says: "This function has been replaced by ListSize(). Use that instead." I'd say that's enough.

This is what I was thinking too.
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: Deprecated commands

Post by MachineCode »

freak wrote:If they copy a code with a non-existing function from the forum they won't know what to do if the message is just "function does not exist"
True, I didn't consider that aspect of it. Sorry for my suggestion, then! :oops:
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: Deprecated commands

Post by nco2k »

@blueznl
#True

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6175
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Deprecated commands

Post by blueznl »

c4s wrote:
blueznl wrote:Perhaps it would make sense to add a link into the help file detailing the replacement comment, wouldn't it?
E.g. CountList() says: "This function has been replaced by ListSize(). Use that instead." I'd say that's enough.
Yup. What I was thinking is keep some sort of warning in there, because after deprecated comes discontinued. So if something is no longer supported, it would no longer be flagged as deprecated, but it would just cause a compiler error. And that's not very beginner friendly :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply