PureBasic 6.00 released !

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: PureBasic 6.00 Beta 10 released !

Post by jacdelad »

@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
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: PureBasic 6.00 Beta 10 released !

Post by BarryG »

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.
plouf
Enthusiast
Enthusiast
Posts: 250
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Re: PureBasic 6.00 Beta 10 released !

Post by plouf »

jacdelad wrote: Wed Jun 15, 2022 5:38 am @plouf: What if I create an include file which us used by someone else? I don't know what value the other person set.
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
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: PureBasic 6.00 Beta 10 released !

Post by jacdelad »

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
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: PureBasic 6.00 Beta 10 released !

Post by RichAlgeni »

Fred wrote: Thu Jun 09, 2022 8:37 pm

Code: Select all

- Added: HTTPTimeout() for HttpRequest commands (reverted the changes from beta 9)
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.

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.
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 6.00 Beta 10 released !

Post by Fred »

I will just remove the command and do it in a future release as it needs more thinking.
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: PureBasic 6.00 Beta 10 released !

Post by RichAlgeni »

Fred wrote: Mon Jun 20, 2022 1:32 pm I will just remove the command and do it in a future release as it needs more thinking.
This was the right decision.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: PureBasic 6.00 Beta 10 released !

Post by Rinzwind »

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.
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: PureBasic 6.00 Beta 10 released !

Post by the.weavster »

Imo having it as a global setting is better than not having it at all :(
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: PureBasic 6.00 Beta 10 released !

Post by infratec »

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.
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: PureBasic 6.00 Beta 10 released !

Post by jacdelad »

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
User avatar
PureBasti
New User
New User
Posts: 8
Joined: Sat Oct 13, 2018 9:02 am

Re: PureBasic 6.00 Beta 10 released !

Post by PureBasti »

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 also think THIS option is the best!!! :mrgreen:
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 6.00 Beta 10 released !

Post by Fred »

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.
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.
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: PureBasic 6.00 Beta 10 released !

Post by User_Russian »

Fred wrote: Wed Jun 22, 2022 10:43 amYou 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 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)
https://www.purebasic.fr/english/viewtopic.php?t=79379
User avatar
NicTheQuick
Addict
Addict
Posts: 1224
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: PureBasic 6.00 Beta 10 released !

Post by NicTheQuick »

A good solution would be named parameters:

Code: Select all

HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.google.com", "", 0, timeout=30000)
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.
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.
Post Reply