Page 1 of 1
'Virgin' flag for Init... commands.
Posted: Tue Jan 30, 2007 10:43 am
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
Posted: Tue Jan 30, 2007 11:07 am
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.
Posted: Tue Jan 30, 2007 2:33 pm
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.
Posted: Tue Jan 30, 2007 2:52 pm
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.

Posted: Tue Jan 30, 2007 2:54 pm
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.
Posted: Tue Jan 30, 2007 2:59 pm
by ts-soft
some functions like this:
would be useful
Posted: Tue Jan 30, 2007 3:12 pm
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.
Posted: Tue Jan 30, 2007 5:25 pm
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.
Posted: Thu Feb 01, 2007 7:25 pm
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
Posted: Thu Feb 01, 2007 7:35 pm
by DoubleDutch
But calling InitNetwork RESETS the network, it doesn't skip it if already initialised.