Page 2 of 2
Posted: Tue Apr 20, 2004 9:35 pm
by GedB
even though it's called IBFriendly, you have to admit that it's not a very friendly way of coding it.. :p

Your not wrong.
I think something good could be done with a bit of code generation.
I really don't won't Fred to take PB in an OO direction, as it is a slippery slope into obscurity and bloat. However, I also want to use OO with the great compilation of PB.
Posted: Wed Apr 21, 2004 8:26 am
by LarsG
mind you, I don't want a complete OO PB language... but the possibility of making your own structures with methods and inheritance... easily!
the current way works, but it's so darn complex and user un-friendly..
Posted: Wed Apr 21, 2004 8:38 am
by Amiga5k
I second LarsG opinion. It'd be nice to just literally put the procedures specific to that structure inside the structure, declare some as private, etc like a "proper" oop language...
It's nice to know it's possible now, though
Russell
Posted: Wed Apr 21, 2004 10:14 am
by GedB
LarsG, Amiga5k,
This is exacly what I'd like to work towards.
My plan is to first create it through code generation. Something like
Code: Select all
Class MyObject
Private
Procedure This
blah
EndProcedure
EndPrivate
Public
Procedure That
blah
EndProcedure
EndPublic
EndClass
This would then be passed through a preprocessor that would convert it into the corresponding PB code.
My biggest problem is the fact that it will have to generate functions, giving them names that will be accessible to other programs. For 'proper' encapsulation the internal procedures should only be accessible through the interface.
I see a couple of solutions to this
1) If PB allowed anonymous functions then I could use these. I ased for them but Fred didn't take the bait
2) Create DLLs. This would be nice a flexible, but you lose static linking. Using VB at work has given me a hatred of DLL hell.
3) Create Userlibraries, similar to the way Tailbite does it. I think this would be a neat solution, but I don't know how to do it. When the time comes I hope El_Choni is willing to show me how.
My implementation of objects would be a little different. I'm hoping to implement them as Relational rather then as a network linked by pointers. If my planning is correct this will allow for perfect resource management with all objects destroyed automatically without the overhead of a garbage collector. It is all part of my planned Master's dissertation.
Posted: Fri Apr 23, 2004 8:12 am
by Amiga5k
Implementing it through code generation would be somewhat of a 'kludge', but I'd go for that until it's REALLY part of the language. (A temporary solution).
Using your example, it would have to be possible to call the particular function with something along the lines of:
Code: Select all
Create bob.MyObject ; Create a new object of class 'MyObject'
returned = bob.This(arg)
Or something like that. Throw in a create and destroy function and it would really start to look like a "respectable" oop language!
Russell
p.s. I like the form\syntax of your example very much. Something along that line would work very nicely!
Posted: Fri Apr 23, 2004 10:13 am
by GedB
I see two options for this.
The first is to have factory functions which would create and return the create object. It would look like this:
Code: Select all
bob.MyObject = Make_MyObject()
jim.MyObject = Make_MyObject_With_A_Value(aValue)
The advantage of this is that it fits nicely into the use of libraries. A DLL or PureLibrary would only have to expose these methods. Everything else would be accessible through the Interface returned.
With this approach the Objects would be thing layers over purebasic code, rather like C++'s classes.
There would be no RTTI.
The Interface would then include a Destroy() method for freeing the resources.
I'm taking my lead from Eiffel, the most respectable of all oop languages.
The other alternative is the Java / Smalltalk approach. There would be a hiearchy of meta objects that could be passed to a creation method. I think this is closer to your example.
As with Java and smalltalk, classes will then be first class objects, with RTTI making reflection/introspection possible.
Personally I'm not convinced of this method. I don't think it ties in with the lightweight PB philosophy.
Posted: Fri Apr 23, 2004 1:12 pm
by dell_jockey
GedB, you're talking design patterns here, cool!
btw: I share your opinion about Eiffel.
Posted: Sun Apr 25, 2004 9:01 am
by Amiga5k
I agree that if PB is going to support objects in this way, it should do so in a fashion not too un-PB like, as we want people to actually WANT to use this new functionality..not be afraid of it (or too confused by it).
Like you say, this approach would be like a thin layer above the core language and I think it would probably be easier for Fred (or whoever) to actually implement without doing a re-write of the core language.
I wonder what Fred thinks of these ideas?
Russell
Posted: Sun Apr 25, 2004 10:46 am
by GedB
I wonder what Fred thinks of these ideas?
I've no idea. My plan is to get something usable and accessible. Once I have that I will start trying to pursuade Fred into making it a core part of the langauge.
Then again, Fred has promised Macros for v4. This may be a reality by then and the preprocessor won't be needed - the macros might be good enough.
In the next few months I'll have a web site up and running with tutorials and a start to the whole process. Don't expect anything in the short term.
Posted: Sun Apr 25, 2004 12:30 pm
by thefool
well i believe that if this happens, the designer would have too much control over the source. The source would have too look as the designer wants it to. I like it the way it is right now, and then nothing is stolen. You have control over the source, not some microsoft-copy source blender weird thing
What i means is that i like to have control over what happens. It would make it easier, and maybe i want it, but i am not unhappy about it right now (and it dosent look like VB)
just my thought..

Posted: Sun Apr 25, 2004 2:47 pm
by Num3
Berikco wrote:I'm looking at it for real

AH! OH!
PB IDE with BUGS !!!

Posted: Sun Apr 25, 2004 9:23 pm
by Amiga5k
thefool wrote:well i believe that if this happens, the designer would have too much control over the source. The source would have too look as the designer wants it to. I like it the way it is right now, and then nothing is stolen. You have control over the source, not some microsoft-copy source blender weird thing
What i means is that i like to have control over what happens. It would make it easier, and maybe i want it, but i am not unhappy about it right now (and it dosent look like VB)
just my thought..

Well, the beauty of this scenario is that if you want to continue to program the way you do now, then you're under no obligation to use the "Visual PB" as a means to create your program. Visual Basic, on the other hand, pretty much takes that control\flexibility out of your hands.
So you could just ignore the parts you don't like and just continue to use PB the same way you do now.
Another possibility is that this "VPB" (Visual PB) could have options that allow you to select how it constructs your program(s), if you choose to use it for that purpose. For example, you could have the choice of using conventional Windows API methods to create windows and react to events, or use PB's built-in commands to do the same. Both methods would have their advantages and disadvantages, although the WinAPI method would be an excellent way to learn how to communicate with Windows on a lower level. This would have limitations in the Linux version, perhaps...
Looking forward to see what you come up with, GedB. Also looking forward to macros, as they can be a lot more powerful than many people may realize.
Russell
Posted: Tue Oct 26, 2004 7:59 pm
by techjunkie
Berikco wrote:LarsG wrote:I'm imagining!!

I'm looking at it for real

How are things going with the "new" Visual Designer Berikco? *curious*
One more question,
Is 3.90 build 1360 the latest official Visual Designer?
(PS: Do you need any beta-testers? :roll: )
Posted: Tue Oct 26, 2004 8:53 pm
by LarsG
Posted: Tue Oct 26, 2004 10:51 pm
by techjunkie
Thanks LarsG!
