Page 2 of 4
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Thu May 03, 2012 11:54 pm
by moogle
The last C code Primoz posted was formatted exactly like Basic style,
the ending brackets or else/endifs are in line with the opening ones.
I do prefer the C style as it's quicker to code and it's easy to read when you code it in that style (Similiar to PB).
Also with the example of having to type out the variable type for each keyword I'm sure in the compiler for C\C++ you can change the settings so it's not so strict and will automatically cast the variable into the standard type.
The basic syntax is okay but I think a mix of other languages combined would be so much better.
Ternary in C\C++ is great too, reduces an If/Else/EndIf block to 1 line.
I also love how in Python you can access strings as an array quickly by using string[5:9] instead of having to use Mid(string, 5, 4)
C# and Java have the nice .function/method style too which I like, but that's because it's OOP which PB will never allow

Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 12:03 am
by Primoz128
moogle wrote:The last C code Primoz posted was formatted exactly like Basic style,
the ending brackets or else/endifs are in line with the opening ones.
I do prefer the C style as it's quicker to code and it's easy to read when you code it in that style (Similiar to PB).
Also with the example of having to type out the variable type for each keyword I'm sure in the compiler for C\C++ you can change the settings so it's not so strict and will automatically cast the variable into the standard type.
The basic syntax is okay but I think a mix of other languages combined would be so much better.
Ternary in C\C++ is great too, reduces an If/Else/EndIf block to 1 line.
I also love how in Python you can access strings as an array quickly by using string[5:9] instead of having to use Mid(string, 5, 4)
C# and Java have the nice .function/method style too which I like, but that's because it's OOP which PB will never allow

Finally someone who agrees.
Also are you maybe a warcraft 3 player ? Your name is very familiar.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 12:13 am
by moogle
Primoz128 wrote:Finally someone who agrees.
Also are you maybe a warcraft 3 player ? Your name is very familiar.
It's a popular name (Final Fantasy), but no I'm not a warcraft 3 player.
The rest of the guys who disagree are so used to the basic syntax they don't like any change I think, and PureBasic is the best language in the world to them.
I suppose I am the outcast

There are others but they've left/inactive or moved on to the proper languages as there's no point staying here for what they want.
PureBasic does beat other languages in fast development of applications (Tried creating a Window in C++?

) and it's great for prototyping.
However sometimes you need to go to those languages you avoided in the first place to get some functionality that you want so it makes sense to know those other languages.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 12:14 am
by Thorium
moogle wrote:but that's because it's OOP which PB will never allow

PB doesnt forbid you to use OOP. You can code OOP in PB.
It's just that PB is a procedural language and by design does not include advanced OOP stuff.
But if you realy want OOP, interfaces are there to give you OOP.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 12:19 am
by Thorium
moogle wrote:
However sometimes you need to go to those languages you avoided in the first place to get some functionality that you want so it makes sense to know those other languages.
Yes it does make sense.
Alone for the fact that you can't develop for all plattforms with PB.
In my opinion C does not offer anything else PB doesnt. If you want OOP C++ will fit you better. But procedural PureBasic is the C of the BASIC's. You can go as low level as you want.
But the original question was about the syntax, if we speak about functionality i just say strings. String handling in C or C++ sucks.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 12:25 am
by moogle
Thorium wrote:PB doesnt forbid you to use OOP. You can code OOP in PB.
It's just that PB is a procedural language and by design does not include advanced OOP stuff.
But if you realy want OOP, interfaces are there to give you OOP.
Yeah I understand PB allows that which is great. I just wish there was a way where procedural and OOP could exist in the language (or at least the compiler could understand it) that way both could be used.
I understand though it's hard to implement (or is it impossible?). I suppose the reason I would like it is that I have no idea how to do the same thing procedurally.
With OOP I'd have a class and it's methods but in procedural would I have to make a new procedure for each method with a different structure?
It's hard to imagine until I see some code where it shows examples of good programming in a procedural language.
I suppose I should ask for help instead of taking the easier way (for me)
Thorium wrote:Yes it does make sense.
Alone for the fact that you can't develop for all plattforms with PB.
In my opinion C does not offer anything else PB doesnt. If you want OOP C++ will fit you better. But procedural PureBasic is the C of the BASIC's. You can go as low level as you want.
But the original question was about the syntax, if we speak about functionality i just say strings. String handling in C or C++ sucks.
Oh yes I don't fault PB for not supporting all platforms for a small team it is very well polished product.
I do agree string's in C\C++ was so complicated, which is one of the pro's of PB.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 12:49 am
by USCode
Just for clarification, are your complaints about the BASIC syntax just around the way it delineates loops? (e.g. no { }) Or about the entire BASIC syntax altogether?
I think STARGATE nailed the key advantage of the more verbose method BASIC uses. When you mix constructs (for-loops, while-loops, if-then, etc.) such as in the example below, it becomes MUCH clearer than versus a sea of identical brackets.
STARGĂ…TE wrote:
sry, I think it looks more chaotic than in Basic!
EDIT:
In Basic, I can see below what keyword is up,
I see in C++ only } } }
Code: Select all
Repeat
For N = 1 To 10
If A = 1
Select B
Case 2
; ...
EndSelect
EndIf
Next
ForEver
Perhaps you might be happier using Go instead of PB?
http://golang.org/
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 12:55 am
by moogle
His complaint was about the length of the keywords to terminate such code blocks.
In C\C++ you just use the braces whereas in Basic you use EndIf.
Bit longer to type was the main point.
Even with the braces lined up in the style like Purebasic you can easily see where it ends, also with the braces highlighting just like PB has for block open/close highlighting you could easily see that. So I think that point is redundant.
Ideally where you should be verbose is your function names so that your code reads like a book.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 12:59 am
by Thorium
moogle wrote:
I suppose the reason I would like it is that I have no idea how to do the same thing procedurally.
With OOP I'd have a class and it's methods but in procedural would I have to make a new procedure for each method with a different structure?
It's hard to imagine until I see some code where it shows examples of good programming in a procedural language.
I suppose I should ask for help instead of taking the easier way (for me)
Why not take the easier way?
Actualy thats why i am using PB so much, because procedural is easier for me. If OOP is easier for you i dont see anything holding you back using a OOP language.
You can do anything with both approaches. Some things are better done with the one and some things are better done with the other one. And there is the personal preference. I tend to do anything in a procedural approache, just because that fits the way i think about problems.
I started programming procedural first, then moved to OOP with VB6 and had a very hard time with it. I used it for years but allways got weird hard to debug problems if i tried to use advanced OOP stuff. That suddently stopped as i switched to PB.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 1:04 am
by moogle
Thorium wrote:Why not take the easier way?
Actualy thats why i am using PB so much, because procedural is easier for me. If OOP is easier for you i dont see anything holding you back using a OOP language.
You can do anything with both approaches. Some things are better done with the one and some things are better done with the other one. And there is the personal preference. I tend to do anything in a procedural approache, just because that fits the way i think about problems.
I started programming procedural first, then moved to OOP with VB6 and had a very hard time with it. I used it for years but allways got weird hard to debug problems if i tried to use advanced OOP stuff. That suddently stopped as i switched to PB.
I want to but I'm stuck where to start or what to read to help me program procedural
I started with VB6 first and got used to object->method(argument, etc, etc) which is why I haven't used PureBasic much even though I have tried to make some programs with it. I can only make simple things
If any one has any links/tutorials for programming procedurally please post them, it'd be very helpful for me.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 1:32 am
by Thorium
moogle wrote:
I want to but I'm stuck where to start or what to read to help me program procedural
I started with VB6 first and got used to object->method(argument, etc, etc) which is why I haven't used PureBasic much even though I have tried to make some programs with it. I can only make simple things
If any one has any links/tutorials for programming procedurally please post them, it'd be very helpful for me.
There is not much to tell about procedural programming.
The main difference is you are not bundling data and code together on procedural programming.
On OOP you have classes that have methods (procedures) and properties (variables) that can be accessed by creating objects out of them.
On procedural you just have procedures (which are the same as methods) that can be accessed just by calling them from everywhere. Procedures dont opperate on data supplied by a object. They operate on data supplied by the parameters and/or on globaly available data like global variables. You don't need to create a object to use them, they are just allways and everywhere available. Maybe try to think about that your whole program is just one object. All procedures are methods, all global variables are properties.
The advantage is that your code can very freely access any code and data and you dont have any overhead for the object handling. Small codes in procedural are typicly smaller and faster written than in OOP because of this.
The disadvantage is that if you want your code to be able to opperate on different data you have to design it that way. You cant just create many objects of the same class. That leads to more work for code that is havily reused.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 1:45 am
by Nituvious
I never had a problem with brackets in C.
I enjoy both syntax, though.
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 1:53 am
by USCode
moogle wrote:...If any one has any links/tutorials for programming procedurally please post them, it'd be very helpful for me.
You're probably looking for something more involved but have you gone through the "We start programming, User Guide - Overview" topic in the latest PureBasic help file?
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 2:56 am
by Tenaja
I have used more languages than I can count, and to me, PB is very c-like compared to other basics. I have used C quite a bit, but prefer Endif/Next etc. over the braces. I am currently using PB primarily for its string handling, which is far and above easier than C. C's biggest advantage is that it is cross platform like no other language; from 8-bit mpu's to 64-bit cpu's.
Syntax is just a minor nit-pick, and most people prefer what they learned with. I can't fathom why a C lover would be on this forum in the first place, when there are so many free C compilers available...unless you are just looking to proselytize us. Afterall, almost all of the "commands" in PB are just implementations of C libraries; why not just code in C if you prefer it? CodeBlocks is a more comprehensive IDE, and coupled with gcc you have a cross platform solution... so... why are you here?
Re: Who here likes the BASIC syntax and why ? If notTHENwhic
Posted: Fri May 04, 2012 3:18 am
by moogle
USCode wrote:moogle wrote:...If any one has any links/tutorials for programming procedurally please post them, it'd be very helpful for me.
You're probably looking for something more involved but have you gone through the "We start programming, User Guide - Overview" topic in the latest PureBasic help file?
Yeah I've just gone through it and it's stuff I already know but thanks for that. I hadn't noticed that new part. I thought the manual only gets updated for functions and such.
I've got much to learn about how the PB team operates
I was more looking for code examples of how something is written procedurally and an example of how it is in OOP but I'm starting to understand a bit more how I would go about programming things without using 'objects'.