Page 5 of 8
Re: OOP Support (it is time)
Posted: Mon Mar 21, 2011 7:55 pm
by TomS
Foz wrote:I prefer the syntax of SimpleOOP, for one reason: procedures in the classes (I can relate to that syntax due to using VB.net at work)
Wait. I thought that was standard, or what do you mean with Procedure inside Class?
Code: Select all
Class myObject
Procedure Init(); Or whatever it's called in simpleOOP (in php eg. it's __construct() )
Debug "A new Object of class myObject was just created"
EndProcedure
EndClass
Are you saying, this is not possible with other pre-compilers?
Re: OOP Support (it is time)
Posted: Mon Mar 21, 2011 8:30 pm
by Foz
No, you declare the procedure in the class, but then write it outside of the class. A very bizarre method from my point of view compared to the way I'm used to doing classes, but there you go.
I think the Declaration method though is very close to the "raw" way of doing things, (interface, structure, procedures, data section)
Re: OOP Support (it is time)
Posted: Mon Mar 21, 2011 8:47 pm
by TomS
Foz wrote:I think the Declaration method though is very close to the "raw" way of doing things, (interface, structure, procedures, data section)
Maybe so. But then I'm glad I use SimpleOOP.
I have to adapt to the small changes in syntax when I come from coding in php, but at least it's generally the same style.
If it's the same in VB then I'm guessing that's kinda the accepted standard and the other pre-compilers fall out of line, because the authors thought PB couldn't handle it, or they themself, of they just didn't want to stray too far away from the pb syntax.
Anyway. Because of this I recommend SimpleOOP over the others to you, c4s
It's also very much like the Feature Request "Procedures inside Structures".
Only that instead of a structure you have a class (in the end it's still a structure with a prototype, ofcourse)
Feature requested in the other thread
Code: Select all
Structure myStructure
int.i
string.s
Procedure test()
Debug string
EndProcedure
EndStructure
Define var.myStructure
var\string = "Hello World"
var\test() ;Hello World
Actual Code with SimpleOOP
Code: Select all
Class MyClass
Public string.s ;Not sure whether public or define, doing this without simple oop right now.
Public Method test()
Debug This\string
EndMethod
EndClass
*Obj.MyClass = NewObject
*Obj\string = "Hello World"
*Obj\test() ;Hello World
Ofcourse normally the variable shouldn't be public. But this immitates the non-working code perfectly. And it works perfectly.
Re: OOP Support (it is time)
Posted: Mon Mar 21, 2011 8:55 pm
by Marlin
Foz wrote:No, you declare the procedure in the class, but then write it outside of the class.
Doesn't that mean, you must watch the names of your procedures?
F.e. can you have a procedure "set" in more than one class under those circumstances?
If you need to fix that using "naming conventions", I do not see the point in using classes at all.
Foz wrote:A very bizarre method from my point of view compared to the way I'm used to doing classes
I certainly agree with that.
OOP supposed to make things simpler, not bloat your code and make you write the same thing twice,
with no real tangible advantage.
Re: OOP Support (it is time)
Posted: Tue Mar 22, 2011 7:30 am
by DaylightDreamer
I think i gonna give try to SimpleOOP with heavy object operations.
And i will put here the results.
Re: OOP Support (it is time)
Posted: Tue Mar 22, 2011 9:52 am
by DaylightDreamer
Hm..
Can someone give me the link to SimpleOOP precompiler. ?
Re: OOP Support (it is time)
Posted: Tue Mar 22, 2011 10:44 am
by c4s
@TomS
Thank you for the tip. I'll give SimpleOOP a try soon.
@DaylightDreamer
Here is the german thread (translated by Bing

):
http://www.microsofttranslator.com/bv.a ... php?t=5915
Download (There also is an english manual in the download archive):
https://www.dropbox.com/s/oo85ru13fidb7zr/SimpleOOP
Re: OOP Support (it is time)
Posted: Tue Mar 22, 2011 12:32 pm
by DaylightDreamer
Thank you

Re: OOP Support (it is time)
Posted: Tue Mar 22, 2011 11:51 pm
by Fluid Byte
What the hell?!
DaylightDreamer wrote:I'm not speaking about pre compilers or some attempts to emulate it ....
DaylightDreamer wrote:I think i gonna give try to SimpleOOP with heavy object operations.
Dude, make up your mind or let it go already ....
Re: OOP Support (it is time)
Posted: Wed Mar 23, 2011 2:11 am
by PMV
Fluid Byte wrote:What the hell?!
DaylightDreamer wrote:I'm not speaking about pre compilers or some attempts to emulate it ....
DaylightDreamer wrote:I think i gonna give try to SimpleOOP with heavy object operations.
Dude, make up your mind or let it go already ....
Why isn't it allowed to change an opinion after a month of
discussion?
Ah yes ... you are a kind of man who would never change
it, no matter what comes

Re: OOP Support (it is time)
Posted: Mon Mar 28, 2011 1:04 am
by VICTOR
Hi!
I'm a newbie in Purebasic and I'm testing SimpleOOP. Compiler shows an error "Invalid memory access. (read error at address 0)" with a simple example:
Code: Select all
EnableExplicit
Class MiClase
Public Variable.l
EndClass
Define *MiObjeto.MiClase
*MiObjeto = NewObject.MiClase
*MiObjeto\Variable = 123
Debug *MiObjeto\Variable
But, if I include a string or an array in class declaration, it works.
Code: Select all
EnableExplicit
Class MiClase
Public Variable.l
Public Cadena$
EndClass
Define *MiObjeto.MiClase
*MiObjeto = NewObject.MiClase
*MiObjeto\Variable = 123
Debug *MiObjeto\Variable
Why? I'm confused
Cheers!
VICTOR
Re: OOP Support (it is time)
Posted: Mon Mar 28, 2011 1:37 am
by TomS
The first code works like a charm.
In which line does the error occur?
Re: OOP Support (it is time)
Posted: Mon Mar 28, 2011 2:05 am
by VICTOR
TomS wrote:The first code works like a charm.
In which line does the error occur?
It fails in:
*MiObjeto = NewObject.MiClase
I'm using Windows 7 (x64). Tomorrow I'll test it in XP 32 bits...
Re: OOP Support (it is time)
Posted: Mon Mar 28, 2011 9:33 am
by VICTOR
I've just test first code in other computer (XP Pro SP3 x86) and it works...
Why this code cracks in Windows 7 64 bits? maybe a bug? a bad installation? a wrong compiler option? a clumsy guy at a computer?
Cheers,
VICTOR
Re: OOP Support (it is time)
Posted: Mon Mar 28, 2011 6:55 pm
by utopiomania
In my opinion, a simple to use and straightforward OO version could be marketed as an
alternative to the current event loop based version, like PB Classic/PB Objects..
I would certainly register the last one, and continue to use both versions.