[Implemented] A few VB touches....
[Implemented] A few VB touches....
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
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....
In PB4 you now have EnableExplicit which does just that.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.
Re: A few VB touches....
> 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.
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.

I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: A few VB touches....
PB wrote:Or maybe I could write a macro for... ah, forget it.

Good programmers don't comment their code. It was hard to write, should be hard to read.
Re: A few VB touches....
Purebasic does not need to be like any language IMHO! and all these things are implemented in V4.0 anyway.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
Re: A few VB touches....
I second thatYogi 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.
Good programmers don't comment their code. It was hard to write, should be hard to read.
Pointers are the pure Way^^ andthis can be taken literal and philosophically
Visit www.sceneproject.org
Don't know.Kale wrote:Am i missing something here.

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);
Good programmers don't comment their code. It was hard to write, should be hard to read.
pb's way is byval, not byref
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
?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
Good programmers don't comment their code. It was hard to write, should be hard to read.
-
- Addict
- Posts: 841
- Joined: Mon Jun 07, 2004 7:10 pm
you PASS the VALUE of the POINTER
that's byval in my book
(a thin book, admitted, but still)
that's byval in my book

( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )