AutoHotkey Community

It is currently May 26th, 2012, 3:38 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 259 posts ]  Go to page Previous  1 ... 13, 14, 15, 16, 17, 18  Next
Author Message
 Post subject:
PostPosted: March 19th, 2009, 8:15 am 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
No, the comparasion is being added. Equals is already added (I think...) And compareTo is in the works. It would make use of the class option Comparable and use function compareTo.

It would allow comparing two objects (mainly used for sorting - whenever that gets added).

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2009, 8:29 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Ok, gotcha. Very cool.

<reverence>
And thanks again for all the changes you've been making recently, such as cloning, equals, constants, the dictionary classes, etc. Not only do I feel important when you promptly consider, and often implement, things I need, but the Class library is really becoming a full OO development toolbox, more-so with every new feature and class added to the package.

I find myself rarely, if ever, using "legacy" libraries anymore if there is a class that does what I need, or I can make a class that does what I need.
-Where I previously used one of the many array classes available in the forums, I am using Array, Vector, or Dictionary depending on my needs.
-Where I used to have to practically re-invent the "object" wheel with each library I created, it's now extremely simple to create new classes and start using them immediately.

Already having these conventions in place through the Class library is almost like having a whole new language through AHK. Like you said, huge kudos go to Chris for creating a language so simple and yet capable of nearly anything. But also, kudos to you for finally bringing together a powerful set of tools to help standardize and simplify development of the standard library, one of the biggest things that had been lacking previously.
</reverence>

It's just a shame there are already so many great libraries available that came out too soon to take advantage of this :)

Here's hoping OOP really catches on around here and we start seeing more libraries converted to classes...

... and more people making fools of themselves in this topic than just me!

--
One of my main projects is SteamLab, and it became so cumbersome and complex that it seemed nearly impossible to continue to handle with AHK. I was looking into other languages to port it to, but this has re-invigorated my desire to keep it in AHK, and I can see new and better ways to do it than ever before. So thanks again :)

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2009, 8:50 am 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
bmcclure wrote:
and more people making fools of themselves in this topic than just me!

Yeah!

Thanks for all your feedback and support. Truthfully, if not for your input and suggestions, I probably would have given up the idea of doing this. It started with me needing a way to move menu items from one menu to another. In all other cases, I could freely move menu items without loosing the "ahk goto label". However, moving a menu item from one menu to another was impossible - I'd have to pass the label as an argument. For this reason, I talked to Lexikos, and he offered a very short (like 30 lines) solution that was a "mini-object". I can't even remember how I was suppose to use it. I saw the idea, and I just wanted to make OOP - using his idea as the base required to allow generic OOP. This would solve my dilemma with moving menu items (which I needed desparately to allow my bookmark manager to function), and it would allow a new dimension in AHK programming.

If you hadn't spit out suggestions, those functions wouldn't have been added - unless I eventually started to need them. Also, if you didn't voice your opinion, I probably wouldn't have kept the library up to date. For example, I've been adding some features to the menu wrapper, and I'm not sure if I'm going to release it. I've gotten like no feedback, and truthfully, it pains me to see code go to waste. I attach to my code the same respect that I would a person (maybe I shouldn't :P). So, if no one gives their feedback, I don't feel like the code is getting respect. I mean, I don't need respect - I get my gratification writing the code (ok, so no one believes me... :D). However, the code deserves respect for what is is capable of (yeah... mabye I shouldn't treat code like a consciousness. Oh well, someone should). I find it disrepectful to the code to keep releasing updates for it to fall on deaf ears.

So, I agree, hopefully the OOP library gets more usage than what it does now, and hopefully it gets more feedback. I mean, obviously I need to hear the feedback, because then I can feel like the code is appreciated. Obviously the code gets its recognition regardless, but it's weird, I don't like "handing" code out unless I think it's in good hands. So the feedback reassures me that it's worth releasing. Maybe I need to get my head examined... such selfish notions aren't too becoming, huh :D?

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2009, 10:31 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Sadly, I haven't looked much into your Menu wrapper yet, but am definitely interested in what it can offer as far as the menus in my scripts go. I'll take a closer look :)

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2009, 1:20 pm 
Quote:
So, I agree, hopefully the OOP library gets more usage than what it does now, and hopefully it gets more feedback
To speak from a (semi)noob perspective. I wish I could use any of those high sophisticated features/functions, which are provided within this section. Unfortunately the majority of those UDFs are not quite 'documented', which isn't a big thing for geeks (I
guess these are the ones who are able to discuss at a 15p+ thread), but won't help any non-geek to get attracted to fight with such components. (bTBH, from time to time I have a try!! :) )

Keep up the good work!
It might need some time to become a pro, but we (the noobish) will do our best. Then we'll come back to salute you (and others who support us the way you do 8))

Rgds
BoBo


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2009, 3:02 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
The docs are done, but lacking some of the new functions, so I'm waiting. However, I guess that they could do more good uploaded. I'll upload what I have and post the rest when I'm done, k?

Also, I'll start a new thread (less intimidating). I'll keep this thread as the "wish list / bug report" thread. The new thread will be where I post updates, and where questions can be asked. This should be more inviting for noobs, right? Sorry, I should have realized that 15+ pages is intimidating when trying new things - especially undocumented things. Sorry about that.

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 4:08 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Here's an idea I had when working more on my Log class.

I figure I might not have the only Log class out there (well, I think I do now, but probably won't in the future). When looking at Java, and I could be wrong, it looks like the core includes support for registering a Logging class, meaning you can use core logging functions to output to the log, regardless of which logger is registered.

Maybe the "concept" of registering a class could be used for other things in the future too, like registering event handlers for things (exceptions, etc.), or to get further-fetched, the ability to register an email-handling class for generic mail capability :)

The idea behind this would be portability of classes. You wouldn't have to develop code particularly for my Log class or a certain Email class or ExceptionHandler class or whatever... you would tell the Class library which class will handle logging, and then use generic Class functions to output logs.

Mainly just looking for your thoughts on the idea. If it's not something that will fit in the scope of the Class library, I'm thinking it can be built into a set of generic classes (Email, Log, ExceptionHandler, etc) I could come up with which would allow registering of custom handlers themselves.

Thanks!

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 4:58 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
Ok, so something like this?

Code:
;LogClassObject would be an object of a class which implements the "Log interface"
Log_write(LogClassObject, Text)
{
    ClassName := Class_getClassName(LogClassObject)
   
    return %CLassName%_write(LogClassObject, Text)
}


If so, that's already possible. If you want to build "interfaces", go ahead. I will gladly distribute any interfaces you (or anyone else) makes with the Class library (if you'll let me, of course). This would allow standardizing certain functionality (like logging).

If you didn't care for a "interface check", then nothing needs to be tweaked. If you would want a check - verify the inputted object actually implements the interface, I would need to tweak the code a little (add interfaces to the class option). Additionally, I would add a function Class_implementsInterface(ClassObject, interface). It would return the object's class name if the object implemented the interface, and the empty string if not. Of course if ClassObject is NULL (0 or blank), the function would return the empty string as well

So, this tweaked version would be:

Code:
;LogClassObject would be an object of a class which implements the "Log interface"
Log_write(LogClassObject, Text)
{
    if ClassName := Class_implementsInterface(LogClassObject, "Log")
        return %ClassName%_write(LogClassObject, Text)
}


Then you would have MyLogClass.

Code:
MyLogClass_initClass()
{
    ;specify Class options in paretheses
    ;the interfaces would be a comma-delimited list starting after the semi-colon
    static ClassName := "MyLogClass(Cloneable;Log,AnotherInterface)"

    ;or this, but it would waste memory (a small bit, granted)
    static ClassName := "MyLogClass(Cloneable) implements (Log,AnotherInterface)"

    return &ClassName
}


As a note, Log_write would call the "write" function for the class object (regardless what class it was). So, there is no need to register, I think. Or did you mean something else?

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 5:22 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
No, I think you're right, since you can get the class name from the object there is no need to register, just to create generic interfaces.

I do think it would be cool to support an "implements" feature so that you can query a class for whether it implements an interface. Of course if it is added, I think it should be entirely optional so that it doesn't waste memory in classes which don't use it.

Your example is pretty much exactly what I'm looking for, except I'm also going to figure out a good way to implement log levels, to try and mimic l4j's capabilities. I'll work on creating some basic interfaces that meet my needs, and if I'm happy with the result I think it would be great to include them as standard interfaces.

Thanks.

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 5:40 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
bmcclure wrote:
Of course if it is added, I think it should be entirely optional so that it doesn't waste memory in classes which don't use it.

Not sure what you mean "optional". You would have to define a class to be a certain interface. Since memory shoud be the focus, I'm thinking the first version's syntax might be better.

So, to specify that a class implements the log interface, you would do this. Of course, cloneable is optional as well - the class doesn't have to be cloneable.

Code:
MyLogClass_initClass()
{
    ;specify Class options in paretheses
    ;the interfaces would be a comma-delimited list starting after the semi-colon
    static ClassName := "MyLogClass(Cloneable;Log)"

    return &ClassName
}


Do you think this might cause confusing? For example this is INCORRECT syntax to specify that a class is cloneable, a wrapper, and implements the Log interface.

Code:
MyLogClass_initClass()
{
    ;specify Class options in paretheses
    ;the interfaces would be a comma-delimited list starting after the semi-colon
    static ClassName := "MyLogClass(Cloneable;Log,Wrapper)"

    return &ClassName
}


This is the correct way (Wrapper and Cloneable can be in either order)

Code:
MyLogClass_initClass()
{
    ;specify Class options in paretheses
    ;the interfaces would be a comma-delimited list starting after the semi-colon
    static ClassName := "MyLogClass(Cloneable,Wrapper;Log)"

    return &ClassName
}


Do you think this might cause confusion. If so, any suggestions on a better syntax?

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 6:17 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
All I meant was not having to specify the 'implements' part if the class didn't implement anything. Based on what you said, it would already be optional anyway, as it would just be part of the class options.

I think it could possibly cause confusion, but can't really think of a better way. Perhaps something like ClassName(Cloneable,Implements[Log,AnotherInterface])?

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 6:48 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
bmmclure wrote:
All I meant was not having to specify the 'implements' part if the class didn't implement anything. Based on what you said, it would already be optional anyway, as it would just be part of the class options.

Oh, ok. Yeah, you would only specify implements if the class actually implemented another class.

bmmclure wrote:
I think it could possibly cause confusion, but can't really think of a better way. Perhaps something like ClassName(Cloneable,Implements[Log,AnotherInterface])?

Ok, how about the second syntax? I think separating the implemented classes from the class options might simplify things.

Code:
MyLogClass_initClass()
{
    ;specify Class options in paretheses
    ;followed by the class' this class implements (if any)
    static ClassName := "MyLogClass(Cloneable) implements (Log,AnotherInterface)"

    return &ClassName
}


If the class doesn't implement any class (like String doen't), you keep the old form.

Code:
;stores a single copy of the class name
String_initClass()
{
    static ClassName := "String(Wrapper,Cloneable)"

    return &ClassName
}


Would that work?

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 6:55 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Yep, I think that would be good.

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 7:07 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
K, I'll add that in and upload the results.

Edit:
Just wanted to say the website is up (not yet up-to-date) - check it out.

I'm taking feedback.

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 7:34 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
That's awesome! My only wish is that the website was posted before I started using the library :) Although to your credit you were, and continue to be, and excellent resource as I learned the basics, and intricacies, of the Class library.

The website should be a great resource for anyone trying to get an introduction to the lib, and will be an excellent reference for me so I don't always have to go back through my other classes to remember how to do something.

If the 15+ pages of this thread were scaring away beginners, one page, http://www.autohotkey.net/~animeaime/ClassLibrary/docs/ClassBasics.htm should be almost all they need to get started :)

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 259 posts ]  Go to page Previous  1 ... 13, 14, 15, 16, 17, 18  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group