Page 10 of 11
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 1:08 am
by idle
All I'd like to see added regarding classes is automated function assignment and public variables to Interfaces
so we don't have to manually write vtable entries in a datasection or poke them in memory
and can access a classes public vars through it's interface rather than calling a function
I don't think either of those would be to difficult to implement.
I'd much prefer to see the compiler getting enhanced to increase it's use cases, rather than the team adding libraries
things like unsigned types, bit fields, native static libraries and extend the macro preprocessor abilities.
Advanced features don't preclude beginners uses of the language but when an advanced user hits the wall
they'll just move on to another general purpose language and eventually leave.
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 1:34 am
by luis
idle wrote:
I'd much prefer to see the compiler getting enhanced to increase it's use cases, rather than the team adding libraries
things like unsigned types, bit fields, native static libraries and extend the macro preprocessor abilities.
Advanced features don't preclude beginners uses of the language but when an advanced user hits the wall
they'll just move on to another general purpose language and eventually leave.
I agree 110%.
Libs are nice, even if sometimes in PB are overly simplified or at least what it's exposed is.
They are nice to have and certainly are one big point especially for beginners, but a more versatile compiler and a more versatile language it's a lot better then more and more libraries added all with some shortcoming.
They are also nice from a certain point of view because their presence tends to standardize the way some problems are solved and they reduce external dependencies when code is posted in the forum.
Using the pre-cooked libraries code can be shorter and easily testable and "recognizable" by anyone.
But in end for me they are first of all a nice cushion to have to try quick and dirty solutions in a hurry or to prototype something, when they fits good enough.
Give me a better tool I can use to write what I need as I see fit.
That's what a language should be first of all.
The order should be IMO:
1) the language... the best possible
2) the compiler... the best possible for that language
3) the "standard library" ... a nice help to have but probably to be used sparingly in some real projects where quality counts more then development time.
So I would like too to have more efforts spent on 1 and 2.
Also, for point 3: less stuff extremely versatile is better then 100 libraries missing important stuff and usable only for some scenarios, and being less it would require less work to be ported on the 3 oses and hopefully would have less bugs, and if any for less time.
But I'm sure other people likes just the opposite, and PB clearly will continue to go its way, so it's just to talk a little between us while at the bar/pub.
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 2:35 am
by idle
If there was the native ability to make static libraries and PB libs
then we the users could add libraries rather than the team, I don't see the logic in the team expending their time adding libraries
it'd be better spent focusing on addressing the short comings that prevent us from doing it ourselves and then let the user community do it.
I don't mind the zimmer frame approach of bolting on libs, they're most welcome but I'd really like to see the compiler get more wheels
and become truly general purpose rather than having to resort to fasm and fasm macros whenever there's something the compiler can't do.
I appreciate the effort the team puts into PB but I'd really like to see more effort put into addressing advanced users requests
classes being one of them and it wouldn't be to difficult to do it, excluding polymorphism.
the compiler already has the ability to handle encapsulation and inheritance so why not polish it up a little.
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 3:33 am
by skywalk
I expect big changes now that M$ is open sourcing .NET and targeting
cross compilation with clang and llvm. Maybe PureBasic can benefit from the same technologies?
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 6:22 am
by Danilo
What do you expect? I don't expect anything from it. PB had never ever a connection to .NET nor LLVM,
and the hundred-thousands of methods in .NET classes are best used with an OOP language. Actually, it is
the thing we are talking about here.
PB is one of few tools that still resists to add additional OOP (Classes, Methods, Inheritance, automatic Constructors/Destructors).
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 6:33 am
by skywalk
Not the .NET stuff. That is bloatware that trails Java bloatware. I mean VS 2015 will have targeted compiles for arm and linux, etc. using clang and llvm. If it is good enough for MS, why wouldn't PB consider a similar approach?
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 6:33 am
by PB
Before someone edited their post, they mentioned PureBasic is slow to
evolve and won't embrace the future for various reasons. Well, to be
frank, that's why I bought the language. Basic is Basic. It's not OOP.
It's not meant to be OOP.
It's not meant to be some sort of gee-whiz
Super Basic with OOP elements. It's the Basic that we dinosaurs know
and love.
If someone wants OOP, then they're in the wrong place. But don't try
to change what's here just because it's not what you expected. Keep
searching instead for the OOP language (with classes) that satisfies
your needs. Can't find one? That's your problem, not Fred's. Simple.
Comprehend: http://www.purebasic.fr/english/viewtop ... 35#p403070
Now, get over this whole OOP and classes whining. It's old. So old.
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 6:52 am
by Danilo
PB wrote:Well, to be frank, that's why I bought the language. Basic is Basic. It's not OOP.
It's not meant to be OOP.
It's not meant to be some sort of gee-whiz
Super Basic with OOP elements. It's the Basic that we dinosaurs know
and love.
If someone wants OOP, then they're in the wrong place.
Sorry, but VB6, VB.NET, BlitzMax, Monkey-X, Xojo (formerly known as RealBasic),
all support some kind of OOP. AFAIK PureBasic is the only modern product that
does not support object-oriented programming (letting QuickBasic aside, it isn't considered modern anymore).
Remember, this is on top of procedural PB, it is an addition and wouldn't change procedural PB in any way.
It would be an addition, and PB would greatly benefit from it.
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 6:57 am
by PB
> VB6, VB.NET, BlitzMax, Monkey-X, Xojo (formerly known as RealBasic)
Of those, VB6, BlitzMax, and Xojo are dead, so they don't count.
That leaves VB.NET and Monkey-X. VB.NET is Microsoft, so that
will probably last due to financial help. Monkey-X is by the same
author of BlitzMax, so how long will that last?
> It would be an addition, and PB would greatly benefit from it
Like I said, PureBasic is not meant to be some sort of gee-whiz
Super Basic with OOP elements. It's just Basic. Old-style Basic.
If Fred agreed with you, he wouldn't have posted this:
"PureBasic won't be object oriented, period."
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 7:06 am
by Danilo
PB wrote:Of those, VB6, BlitzMax, and Xojo are dead, so they don't count.
The result is the same, PureBasic is the only one not supporting OOP actively.
ALL modern languages are OOP, or support OOP style for a reason.
Anyway, not my probem. Just installed latest BlitzMax, Blide, and all of Brucey's
addon-modules, including wxMax.
Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 7:07 am
by PB
> PureBasic is the only one not supporting OOP actively
That's what makes it stand out and above the others.
Anyway, I won't lock horns with you anymore.

Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 12:06 pm
by luis
PB wrote:Before someone edited their post, they mentioned PureBasic is slow to
evolve and won't embrace the future for various reasons.
I always save the brutally sincere Danilo posts in their original forms when I can before they get edited, I don't like them as much after the edits

Re: Classes in PureBasic
Posted: Sun Nov 16, 2014 12:46 pm
by Shield
Alexi wrote:[..]will donate much more for an actively maintained language [..]
Myself, I'm unfortunately well past this point. I would have done it a couple of years back when I still had a code base in PB.
But I wonder how many other people think that (e.g. how much $$), though it won't probably matter anyway.

Re: Classes in PureBasic
Posted: Mon Nov 17, 2014 10:27 pm
by fsw
How about implementing OOP into PureBasic in a similar fashion as Go?
Go is not an OOP language but has all the tools to extend types with functions.
For starters only a few additional keywords are needed.
Self and
SelfType.
Example of working code (with implemented semi-OOP):
Code: Select all
Structure Animal
Name.s
mean.b
EndStructure
Structure Cat Extends Animal
MeowStrength.i
EndStructure
Structure Dog Extends Animal
BarkStrength.i
EndStructure
Procedure MakeNoise() Extends Animal
If Self.mean = #True
If SelfType = Cat
Self.MeowStrength = 10
ElseIf SelfType = Dog
Self.BarkStrength = 10
EndIf
EndIf
EndProcedure
Or
Procedure MakeNoise() Extends Cat
If Self.mean = #True
Self.MeowStrength = 10
EndIf
EndProcedure
Procedure MakeNoise() Extends Dog
If Self.mean = #True
Self.BarkStrength = 10
EndIf
EndProcedure
If the implementation also allows overrides than the procedure "MakeNoise() Extends Cat" would override "MakeNoise() Extends Animal".
Also if things like constructors and destructors are really needed, this:
Code: Select all
Procedure Init() Extends Animal
; constructor
; do something
EndProcedure
Procedure Exit() Extends Animal
; destructor
; do something
EndProcedure
would cover it.
(Or extend Cat/Dog)
Super complicated OOP techniques and keywords are not needed to facilitate OOP programming style.
In the end only 4 new keywords would get you a long way...
Easier said than done

Re: Classes in PureBasic
Posted: Tue Nov 18, 2014 5:24 am
by coco2
I dislike OOP because it takes programming to too high a level. BASIC to me means getting 'down and dirty' on the mud with your hardware and OS, not prancing about up in clouds or rainbows! Boooo to OOP and yes I know how to use it
