Page 1 of 2
[Implemented] A few VB touches....
Posted: Wed Mar 22, 2006 11:54 am
by Yogi Yang
Like in Vb there should be provision for forcing a developer to first declare variables and then use them if the developer wishes. I would go for a parameter like - Option Explicit (as implemented in VB) so if developer needs to force himself to declare each and every variables he will put Option Explicit at the top of the code module.
There should be provision for passing parameters to a function/routine either - ByVal or ByRef this would really help esp. ByRef as in VB.
A large set for Functions for manuplating Strings like those in VB and more, Arrays & such collections features as implemented in VB.NET would be great to have in PB.
I know there are many workarounds in form of UserLibs but it would be nice to have these features built right in PB ranther than in third party UserLib. Generally developers of UserLibs are hobbies and may loose their interest in a particular UserLib and many discontinue developing it or ditch it all togather. And over a period of time these UserLibs may become incompatible with newer versions of PB.
What do other developers think about this
Re: A few VB touches....
Posted: Wed Mar 22, 2006 12:10 pm
by maw
Yogi Yang wrote:Like in Vb there should be provision for forcing a developer to first declare variables and then use them if the developer wishes. I would go for a parameter like - Option Explicit (as implemented in VB) so if developer needs to force himself to declare each and every variables he will put Option Explicit at the top of the code module.
In PB4 you now have EnableExplicit which does just that.
Re: A few VB touches....
Posted: Wed Mar 22, 2006 12:12 pm
by PB
> there should be provision for forcing a developer to first declare variables
Use the EnableExplicit command.
> A large set for Functions for manuplating Strings
Like what? There are many string commands at the moment.
Or maybe I could write a macro for... ah, forget it.

Re: A few VB touches....
Posted: Wed Mar 22, 2006 12:18 pm
by traumatic
PB wrote:Or maybe I could write a macro for... ah, forget it.


Posted: Wed Mar 22, 2006 12:19 pm
by Dare2
Re: A few VB touches....
Posted: Wed Mar 22, 2006 12:46 pm
by Kale
Yogi Yang wrote:Like in Vb there should be provision for forcing a developer to first declare variables and then use them if the developer wishes. I would go for a parameter like - Option Explicit (as implemented in VB) so if developer needs to force himself to declare each and every variables he will put Option Explicit at the top of the code module.
There should be provision for passing parameters to a function/routine either - ByVal or ByRef this would really help esp. ByRef as in VB.
A large set for Functions for manuplating Strings like those in VB and more, Arrays & such collections features as implemented in VB.NET would be great to have in PB.
I know there are many workarounds in form of UserLibs but it would be nice to have these features built right in PB ranther than in third party UserLib. Generally developers of UserLibs are hobbies and may loose their interest in a particular UserLib and many discontinue developing it or ditch it all togather. And over a period of time these UserLibs may become incompatible with newer versions of PB.
What do other developers think about this
Purebasic does not need to be like any language IMHO! and all these things are implemented in V4.0 anyway.
Re: A few VB touches....
Posted: Wed Mar 22, 2006 12:49 pm
by traumatic
Yogi Yang wrote:There should be provision for passing parameters to a function/routine either - ByVal or ByRef this would really help esp. ByRef as in VB.
I second that
Posted: Wed Mar 22, 2006 3:01 pm
by Nik
Pointers are the pure Way^^ andthis can be taken literal and philosophically
Posted: Wed Mar 22, 2006 3:06 pm
by Kale
Nik wrote:Pointers are the pure Way^^ andthis can be taken literal and philosophically
Agreed! Never having used VB i dont get why you would need ByVal or ByRef when you can use pointers. Am i missing something here.

Posted: Wed Mar 22, 2006 4:13 pm
by traumatic
Kale wrote:Am i missing something here.

Don't know.
This is not a matter of VB (other languages allow you to chose how
to pass parameters as well **), it's a matter of design/concept/needs.
Using
ByVal, only a copy of the parameter will be used inside the
procedure. This prevents the procedure from changing the passed
data. Values are being preserved.
(Using a copy obviously allocates memory when calling the procedure
and comes with a certain performance hit of course.)
With
ByRef (PB's way) on the other hand you're passing a memory
location, thus allowing the procedure to change the passed data,
which may not always be wanted.
** think of C for example:Code: Select all
void ByVal(yourStruct var);
void ByRef(yourStruct& var);
[/size]
Posted: Wed Mar 22, 2006 4:24 pm
by blueznl
pb's way is byval, not byref
Posted: Wed Mar 22, 2006 4:26 pm
by traumatic
blueznl wrote:pb's way is byval, not byref
?
Code: Select all
Procedure AreYouSure(*var.POINT)
*var\x = 10
EndProcedure
AreYouSure(myVar.POINT)
Debug myVar\x
Posted: Wed Mar 22, 2006 4:31 pm
by Bonne_den_kule
PB 4.00 has prototypes which can handle pointers like byref in VB.
Posted: Wed Mar 22, 2006 4:32 pm
by blueznl
you PASS the VALUE of the POINTER
that's byval in my book

(a thin book, admitted, but still)
Posted: Wed Mar 22, 2006 4:43 pm
by traumatic
We must have different books then.