'Virgin' flag for Init... commands.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

'Virgin' flag for Init... commands.

Post by DoubleDutch »

Init... commands should have a flag to skip if they have already been called.

This would avoid problems such as:

http://www.purebasic.fr/english/viewtop ... 160#180160

You could add an optional force Init.. with a flag:

Code: Select all

InitNetwork() ; Ensure init network called only once

Code: Select all

InitNetwork(#True) ; Force init network
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

I suppose if you are using libraries etc then you don't know what has been INITed so this would be a good thing.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

Derek wrote:... if you are using libraries etc then you don't know what has been INITed ...
pardon.
this would be a crap library if it's that bad documented...

sorry.. *shaking his head is disgust*

a Lib INITing anything without telling me at least in the documentation...

unbelievable... shear horror... missing words to tell my feelings...
netmaestro wrote:Anyone who concieves of such a construct should be flogged 'round the fleet, keelhauled and fed piecemeal to the sharks.
this word is true here, too.
oh... and have a nice day.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

It was only an example of why the request was a good one.

Calm down abit, go and have a coffee or something.

Also, I'm sure there are libs out there that don't document every little thing, but if there isn't then that's just fine.

:shock:
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

And, what if you want to run several different libs and they all try to INIT, surely that would cause a problem. Unless you have the source code for each one and you edit them.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

some functions like this:

Code: Select all

IsNetworkInit()
IsSpriteInit()
would be useful
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

... have a coffee or something ...
do I sound as if my blood pressure isn't already high enough?

no, kidding. ;) I'm perfectly calm.

I just wanted to express what I think about Documentations and Libs in general.

I won't request anyone to write a Lib, but if they do, they should put a reliable and complete documentation to it.

For OpenSource it's not that critical matter, but for compiled Libs a good documentation is vital.

I once wrote a 328-line well commended Include for Sprite-Animations,
and I put a 309-line Documentation to it...


it's just my opinion, but for me a good documentation is a really serious thing.


sorry for OT...
B.O.T.:

something like a flag
or a request-function like ts suggested
would be a good idea.
oh... and have a nice day.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Kaeru Gaman: The documentation for PureSMTP and PurePOP3 is great (especially considering it all free!) - its just one of those things that things went wrong.

A temporary solution has been found for the linked example with a short amount of time.

My suggestion was to Fred - that it may be a good idea to include an enhancement to the Init... commands was for the next official release of PureBasic.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Dr. Dri
Enthusiast
Enthusiast
Posts: 243
Joined: Sat Aug 23, 2003 6:45 pm

Post by Dr. Dri »

there isn't any problem, if you turn the debugger off you'll get a message and if you turn it on you'll have to use the debugger "Continue" feature and once again you'll get the message... no problem...

Code: Select all

InitSprite()

If InitSprite()
  MessageRequester("initsprite", "already initialized")
EndIf
Dri
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

But calling InitNetwork RESETS the network, it doesn't skip it if already initialised.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply