[Implemented] Redim PRESERVE
-
- User
- Posts: 77
- Joined: Sun Nov 02, 2003 1:47 pm
- Location: Washington
- Contact:
[Implemented] Redim PRESERVE
In PureBasic, you can resize an array with DIM but as the helpfile states all data in the array is lost. In all programing languages I have ever used there was some optional keyword that allowed you to redim an array and KEEP the original data intact (unless of course you dim it to a smaller size you of course lose what was trimmed off) In most basic dilects this comes in the form of
REDIM MyArray(ArraySize)
OR
REDIM PRESERVE MyArray(ArraySize)
From the documentation I dont see any such command.
Now im sure you can manually make a copy of the memory, redim the array and plop the data back down on it. But the point of high level languages is to simplify the programing proccess.
It would be nice to see such a function in PureBasic.
REDIM MyArray(ArraySize)
OR
REDIM PRESERVE MyArray(ArraySize)
From the documentation I dont see any such command.
Now im sure you can manually make a copy of the memory, redim the array and plop the data back down on it. But the point of high level languages is to simplify the programing proccess.
It would be nice to see such a function in PureBasic.
AMD 2600+, nVidia Geforce FX 5200 128 MB DDR, 512 DDR, RedHat 9
Suppose this is already on the ToDo list:
viewtopic.php?t=7988&highlight=redim
viewtopic.php?t=6160&highlight=redim
You know there is a search function in this forum....
viewtopic.php?t=7988&highlight=redim
viewtopic.php?t=6160&highlight=redim
You know there is a search function in this forum....
-
- User
- Posts: 77
- Joined: Sun Nov 02, 2003 1:47 pm
- Location: Washington
- Contact:
Not a very good one.fsw wrote:You know there is a search function in this forum....
It either returns no results, or a ton of results (which usually have nothing to do with what you are searching for) so I dont even bother anymore.
Not to mention PureBasic names their commands some of the oddest things that are not common names, so trying to search for them are pointless.
I tried searching for Command$ (which it is in nearly every basic dialect), Command(), CommandLine, etc... about 10 differnt options, and FINALLY stumbled upon "ProgramParamater" ?? Same for things like "MessageRequester", which every basic dialect uses "MsgBox". To me, comming from these other languages, trying to search for functions that may exist or may be on the list to do, is nearly pointless.
AMD 2600+, nVidia Geforce FX 5200 128 MB DDR, 512 DDR, RedHat 9
-
- Enthusiast
- Posts: 384
- Joined: Sat May 24, 2003 8:02 pm
- Location: Canada
- Contact:
I get the same problem searching, it returns a ton of results so I click on the option "Search for all terms" when I do a search, that way it narrows it down pretty good.
I also had the same problem switching from VB to PB, with certain commands. Thats something that just takes time to get used to. Now I don't even wan't to go back to VB. Also I don't think PB fits in the High Level programming language, or the Low Level programming language. I think it is in between. Nice Mix
I also had the same problem switching from VB to PB, with certain commands. Thats something that just takes time to get used to. Now I don't even wan't to go back to VB. Also I don't think PB fits in the High Level programming language, or the Low Level programming language. I think it is in between. Nice Mix

<br>"I deliver Justice, not Mercy"
    - Codemonger, 2004 A.D.
    - Codemonger, 2004 A.D.
Searching any glob of text is frustrating for sure. Be careful what you're searching on and don't expect perfect results. Sometimes you won't find anything on the forum, other times you'll have way too much information!Not a very good one.It either returns no results, or a ton of results (which usually have nothing to do with what you are searching for) so I dont even bother anymore.
That has nothing to do with the forum search and everything to do with you needing to read the PureBasic documentation. Every language does things it's own way and PB is no exception. Reading through the help file will give you a good idea on what things are called and how to get more information from the forum. The docs do need work but things like what you just outlined are covered pretty well.I tried searching for Command$ (which it is in nearly every basic dialect), Command(), CommandLine, etc... about 10 differnt options, and FINALLY stumbled upon "ProgramParamater" ?? Same for things like "MessageRequester", which every basic dialect uses "MsgBox". To me, comming from these other languages, trying to search for functions that may exist or may be on the list to do, is nearly pointless.
Good luck!

-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
-
- User
- Posts: 77
- Joined: Sun Nov 02, 2003 1:47 pm
- Location: Washington
- Contact:
But purebasic has BASIC in its name and claims to follow BASIC language standards, which it BARELY does. You cannot search for something on the help file if you have no clue what the name is. I must have passed MessageRequester 100 times on the help doc and never figured it out, it wasnt until I stumbled upon it in an example demo that I realized what it was. Each language has its own commands and style, of course, but most languages follow common ground to lower the learning curve. Not to mention something like MessageRequester is a pain to type over and over and over again (I use about 100 message boxes or more in my app), its kind of pathetic that I have to write a Procedure to wrap MessageRequester into a smaller name "MsgBox" which all other dialects of basic already have. (macros would come in handy in these situations, allowing those of us that want things named "properly" can simply write macros for them rather than wrap them into actual procedures)That has nothing to do with the forum search and everything to do with you needing to read the PureBasic documentation. Every language does things it's own way and PB is no exception.
Its not hard to oust VB. Its a slow, bulky, bloated language that requires a 1.4 MB runtime for a hello world app (not to mention the exe size is huge as well) . VB doesnt even compile to true native code. It compiles to part native part pcode (even with the native option choosen), I gave up VB along time ago for PowerBasic, but unlike PureBasic, I was able to copy and paste 99.9% of my VB code into PowerBasic (a language that follows basic standards), In purebasic I cannot even copy %5 of my code over, EVERY LINE has to be rewritten in the mixed PureBasic langauge. Not saying its a bad language, far from it, its a very good start, but it shouldnt call itself basic.Now I don't even wan't to go back to VB.

But this topic has strayed far from its original purpose. ReDim Preserve would be a nice addition to the commands of purebasic. If this is already on the todo list, put another check by it for me


AMD 2600+, nVidia Geforce FX 5200 128 MB DDR, 512 DDR, RedHat 9
> But purebasic has BASIC in its name and claims to follow BASIC language standards
So... what's basic standart then? Is everything VB does automatically called a standart?
I can't find any document on the net describing the *official* basic
standart. Maybe you can...
IMHO, basic defines the general syntax. Like we use words like Repeat/Until
instead of some cryptic {} notations. The naming of the individual functions
doesn't have much to do with it.
The PureBasic way of naming functions, simply: full names, that describe
the functions purpose. IMHO, that's much better to learn for a newby than
than those shortcuts, most other languages use. btw, that's what basic
stands for: an easy to learn language.
btw, if all languages would be ecactly 100% code compatible, they would
all be the same language (just different compilers)
I'm a bit tired of everybody thinking that PureBasic should be like
every language they used before. PB has it's own special mix, and
that's what makes it so good.
Timo
So... what's basic standart then? Is everything VB does automatically called a standart?
I can't find any document on the net describing the *official* basic
standart. Maybe you can...
IMHO, basic defines the general syntax. Like we use words like Repeat/Until
instead of some cryptic {} notations. The naming of the individual functions
doesn't have much to do with it.
The PureBasic way of naming functions, simply: full names, that describe
the functions purpose. IMHO, that's much better to learn for a newby than
than those shortcuts, most other languages use. btw, that's what basic
stands for: an easy to learn language.
btw, if all languages would be ecactly 100% code compatible, they would
all be the same language (just different compilers)
I'm a bit tired of everybody thinking that PureBasic should be like
every language they used before. PB has it's own special mix, and
that's what makes it so good.
Timo
quidquid Latine dictum sit altum videtur
hey timo, don't get carried away 
yea, i *love* purebasic, but there is nothing wrong with a little improvement, and you can't blame other people for preferring what they were used to...
in fact, i have to agree with both of you
there is no 'standard' but now and again it would be nice if purebasic would somewhat conform to the way other basics do things 

yea, i *love* purebasic, but there is nothing wrong with a little improvement, and you can't blame other people for preferring what they were used to...
in fact, i have to agree with both of you


( 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... )
I whole heartedly agree with this statement!The PureBasic way of naming functions, simply: full names, that describe the functions purpose. IMHO, that's much better to learn for a newby than than those shortcuts, most other languages use. btw, that's what basic stands for: an easy to learn language.
btw, if all languages would be exactly 100% code compatible, they would
all be the same language (just different compilers)
I'm a bit tired of everybody thinking that PureBasic should be like every language they used before. PB has it's own special mix, and that's what makes it so good.
-
- User
- Posts: 77
- Joined: Sun Nov 02, 2003 1:47 pm
- Location: Washington
- Contact:
So by your concept, MessageRequester should ACTUALLY beThe PureBasic way of naming functions, simply: full names, that describe
the functions purpose
SmallModalDialogBoxWithTextAndOptionalButtonsAndIcons
You have to draw the line somewhere.
"MessageRequester" ?? how does that describe what it does? I am not REQUESTING anything. Just a simple box with text on it and an OK button. No requests, more like NOTIFICATIONS.
As for the "Standard" of basic, I can take atleast 70% of my code and copy and paste it into 5 or more differnt basic languages WITHOUT modification. That is standards. I have NEVER seen Repeat:Until in ANY basic language. All other basics have DO : LOOP or DO : UNTIL, even when PureBasic gives common functions they give uncommon names, making porting of code a pain in the ass.
BTW, It has nothing to do with being easy, Beginers Allpurpose Symbolic Instruction Code. It mentions beginers but never easy.btw, that's what basic
stands for: an easy to learn language.
But if your going to have the same commands as the 20+ other dialects out there, WHY OH WHY name them something different? You talk about easy to learn, if you keep the same names for the same functions its ALOT easier for people coming from any other basic background, to learn PureBasic.
Just another reason to add macros, so we can change the language back to a real basic syntax so porting will be alot easier.
I am not saying PureBasic should be "some other language" I am saying they shouldnt claim they "All BASIC keywords are supported" when that is an outright lie.
Last edited by Akuma no Houkon on Mon Nov 10, 2003 6:39 pm, edited 1 time in total.
AMD 2600+, nVidia Geforce FX 5200 128 MB DDR, 512 DDR, RedHat 9
Yes and Fred has drawn his line with MessageRequester()Akuma no Houkon wrote:So by your concept, MessageRequester should ACTUALLY beThe PureBasic way of naming functions, simply: full names, that describe
the functions purpose
SmallModalDialogBoxWithTextAndOptionalButtonsAndIcons
You have to draw the line somewhere.
You request input of some sort, be it OK, YES, NO or CANCEL"MessageRequester" ?? how does that describe what it does? I am not REQUESTING anything. Just a simple box with text on it and an OK button. No requests, more like NOTIFICATIONS.
Yes, if Fred's aim was to make another VB clone or whatever then he has failed misserably...As for the "Standard" of basic, I can take atleast 70% of my code and copy and paste it into 5 or more differnt basic languages WITHOUT modification. That is standards. I have NEVER seen Repeat:Until in ANY basic language. All other basics have DO : LOOP or DO : UNTIL, even when PureBasic gives common functions they give uncommon names, making porting of code a pain in the ass.
BTW i never ever liked the DO-loops in other languages..
-
- User
- Posts: 77
- Joined: Sun Nov 02, 2003 1:47 pm
- Location: Washington
- Contact:
You misunderstand Pupil, Fred CLAIMS PureBasic support ALL BASIC KEYWORDS, (from a quote on the main site) which is a lie, an over exageration. If it supported ALL basic keywords (like the site says) it would have things such as DO : LOOP and a list of probably 100+ more commands. Although in most cases it supports those FUNCTIONS it does NOT support those KEYWORDS.
A big differnce.
I am not saying purebasic is a bad language, like I said I havent found better for linux yet (though I would never use it for windows). I am saying its false advertisement. They should not say such things when they are not true. I picked up purebasic and started to search the help file for all the basic keywords that I have used in every basic dialect I have ever used (commands that have become standard over the past 20 years). And I find about 1 out of every 30 that use the basic keywords. ATLEAST he can add those commands to the help file and link them to the actual purebasic command, so those of us from differnt backgrounds can still find the proper command.
But again we stray far from the original topic, why not let it die? I have said my peice and obvously its already been said before, so this topic does not need to continue.
I am not going to stop using PureBasic because of these flaws, and still recommend it for all my linux friends that want to program in linux, but nothing will ever change unless you say something, and im saying something. I am sure fred would be more than willing to create aliased commands, so purebasic can follow more closly to the standards yet still give the same old functions that it always has.
If so I would be more than willing to make up a nice list for him.

I am not saying purebasic is a bad language, like I said I havent found better for linux yet (though I would never use it for windows). I am saying its false advertisement. They should not say such things when they are not true. I picked up purebasic and started to search the help file for all the basic keywords that I have used in every basic dialect I have ever used (commands that have become standard over the past 20 years). And I find about 1 out of every 30 that use the basic keywords. ATLEAST he can add those commands to the help file and link them to the actual purebasic command, so those of us from differnt backgrounds can still find the proper command.
Not really, it IS like every other language (with just a TINY unquieness), except it just renames the commands. It still has most of the same commands except they have odd, uncommon, names.I'm a bit tired of everybody thinking that PureBasic should be like every language they used before. PB has it's own special mix, and that's what makes it so good.
But again we stray far from the original topic, why not let it die? I have said my peice and obvously its already been said before, so this topic does not need to continue.
I am not going to stop using PureBasic because of these flaws, and still recommend it for all my linux friends that want to program in linux, but nothing will ever change unless you say something, and im saying something. I am sure fred would be more than willing to create aliased commands, so purebasic can follow more closly to the standards yet still give the same old functions that it always has.
If so I would be more than willing to make up a nice list for him.
AMD 2600+, nVidia Geforce FX 5200 128 MB DDR, 512 DDR, RedHat 9
OK 
As i see it the BASIC keywords are IF:ELSEIF:ELSE:ENDIF, FOR:NEXT, WHILE:WEND, REPEAT:UNTIL, SELECT:CASE:ENDSELECT, DIM, GOTO, GOSUB, RETURN, RESTORE, AND, OR etc. (there are a few more but they just don't come to mind right now).
And in my opinion most, if not all, are supported and are named the same in PB as in many other BASIC dialects..

As i see it the BASIC keywords are IF:ELSEIF:ELSE:ENDIF, FOR:NEXT, WHILE:WEND, REPEAT:UNTIL, SELECT:CASE:ENDSELECT, DIM, GOTO, GOSUB, RETURN, RESTORE, AND, OR etc. (there are a few more but they just don't come to mind right now).
And in my opinion most, if not all, are supported and are named the same in PB as in many other BASIC dialects..
Last edited by Pupil on Mon Nov 10, 2003 7:13 pm, edited 1 time in total.