PureBasic 6.00 released !
Re: PureBasic 6.00 Beta 10 released !
@plouf: What if I create an include file which us used by someone else? I don't know what value the other person set.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: PureBasic 6.00 Beta 10 released !
Rename any global variables that you get from someone else. It's what I did for some "eval(string$)" code I got from somone. I renamed all the variables and procedures in it to be prefixed with "MyCompanyMyAppname_" so it won't clash with any of my existing code or any future code from others.
Alternatively wrap it in a module so it doesn't clash.
Alternatively wrap it in a module so it doesn't clash.
Re: PureBasic 6.00 Beta 10 released !
if you create an include file, would not use ANY other variables?
based in your logic if your include has a function with same name of other person own fucntion ?
my point is, that an include /dll has "guidelines" for other persons to use and a well named declared variable called "global httptimeoutvalue.l"
is really difficult to mean anythink else
Christos
Re: PureBasic 6.00 Beta 10 released !
Wouldn't it be easier to simply receive the timeout instead of proposing global variables and "the programmer should follow this or that"?
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
- RichAlgeni
- Addict
- Posts: 914
- Joined: Wed Sep 22, 2010 1:50 am
- Location: Bradenton, FL
Re: PureBasic 6.00 Beta 10 released !
Thinking about this, I do not believe this is best practice. For single threaded apps, it is probably fine. But for multi-threaded apps, I can envision this causing multiple headaches.Fred wrote: ↑Thu Jun 09, 2022 8:37 pmCode: Select all
- Added: HTTPTimeout() for HttpRequest commands (reverted the changes from beta 9)
You NEVER want to change the number of parameters passed to a procedure. And you never want a global command to set parameters in a thread, unless they are defaults, and can be overridden per thread.
Given this, I would rather see two new commands, which include the extra parameters for timeout variables.
Re: PureBasic 6.00 Beta 10 released !
I will just remove the command and do it in a future release as it needs more thinking.
- RichAlgeni
- Addict
- Posts: 914
- Joined: Wed Sep 22, 2010 1:50 am
- Location: Bradenton, FL
Re: PureBasic 6.00 Beta 10 released !
Timeout as a parameter with a default value to procedures where it was severely missed since beginning would be the right decision. Btw, We had breaking changes frequently in PB during the years.
- the.weavster
- Addict
- Posts: 1537
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
Re: PureBasic 6.00 Beta 10 released !
Imo having it as a global setting is better than not having it at all
Re: PureBasic 6.00 Beta 10 released !
There is definately no problem adding the OPTIONAL parameter timeout as the last one in the command.
It will break nothing and if needed you can fill the parameters before with 0 or #Null or the requested default values.
I was amazed that Fred placed it somewhere in between which definately breaks old code.
It will break nothing and if needed you can fill the parameters before with 0 or #Null or the requested default values.
I was amazed that Fred placed it somewhere in between which definately breaks old code.
Re: PureBasic 6.00 Beta 10 released !
I also think it would be the best just add another parameter at the end. Full compatibility plus full control for every single download, no matter if it's done in the main program or an include or whatever.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: PureBasic 6.00 Beta 10 released !
I also think THIS option is the best!!!
Re: PureBasic 6.00 Beta 10 released !
You can't pass #Null or 0 to a Map parameter for now, that's why I switched it as you would need to always create an empty map. I will probably add the possibility to pass #Null for a map but it requiers a compiler change, so it's postponed for next version.infratec wrote: ↑Wed Jun 22, 2022 8:26 am There is definately no problem adding the OPTIONAL parameter timeout as the last one in the command.
It will break nothing and if needed you can fill the parameters before with 0 or #Null or the requested default values.
I was amazed that Fred placed it somewhere in between which definately breaks old code.
-
- Addict
- Posts: 1443
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: PureBasic 6.00 Beta 10 released !
I think the solution may be like that. https://www.purebasic.fr/english/viewtopic.php?t=79379
Code: Select all
Procedure Proc(Array a(1), List l(), Map m())
If IsArray(a())
; This code will be executed if the Array is valid.
EndIf
If IsList(l())
; This code will be executed if the List is valid.
EndIf
If IsMap(m())
; This code will be executed if the Map is valid.
EndIf
EndProcedure
Proc(0, 0, 0)
- NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: PureBasic 6.00 Beta 10 released !
A good solution would be named parameters:
This way optional parameters could be set by name in any order like Python can do it. And if names are not given the original order is assumed so it would not break old code.
Code: Select all
HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.google.com", "", 0, timeout=30000)
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.