Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[AHK_L] OOP preprocessor v1.1a


  • This topic is locked This topic is locked
22 replies to this topic
derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007

BTW, is this the answer to nubAHK (or inevitable universe balancing) ?
Perhaps you should make a wiki or something :D


dont be mean.

All scripts, unless otherwise noted, are hereby released under CC-BY

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
I am just teasing you guys. I might be mean a little bit too :)
Posted Image

noee
  • Members
  • 13 posts
  • Last active: Nov 26 2012 03:39 AM
  • Joined: 01 Nov 2010
First, excellent work on the particular "sugar" for class defn. I'm converting an app that controls my HTPC, love it so far.

Not sure what to make of this. In one class, I am defining properties *and* overriding __Get. When doing this, the override is not working (properties work fine). Bug with the new addition of Properties support?

class Ihtpc....
.
.
.
	property VideoRenderer
		get
		{
			return this.MPC.Video
		}
	endprop
	property AudioRenderer
		get 
		{
			return this.MPC.UseReclock ? this.RC.KS_Device : this.MPC.Audio
		}
	endprop

	method __Get(name)
	{
	  static def, prim
	  ; app specific Playback monitor device
	  if (name="mon" || name="monitor") {
		if !def
		  def := this.displays.defindex
		return this.displays[def]
	  }
	  ; Windows primary monitor device
	  if (name="prim" || name="primary") {
		if !prim
		  prim := this.displays.primindex
		return this.displays[prim]
	  }
	}
.
.
.
endclass


fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Glad someone found an use for my silly script :)
Of course your custom __Get handler is going to be skipped as the property __Get handler is at the very end of the Object() call used to create the base object. In your particular case you're using it to make aliases. Perhaps I should implement them?
property monitor alias mon


Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
I suggest:
; In place of "alias":
property monitor = mon  ; assert equality, or
property monitor := mon ; assign name

; To allow __Get and __Set to be extended:
property this[params]
{
    ...
}


noee
  • Members
  • 13 posts
  • Last active: Nov 26 2012 03:39 AM
  • Joined: 01 Nov 2010

...
Of course your custom __Get handler is going to be skipped as the property __Get handler is at the very end of the Object() call used to create the base object. In your particular case you're using it to make aliases. Perhaps I should implement them?


Okay, yeah, my bad, I wasn't paying attention. Yup, aliases in some form would be useful.

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
@Lexikos: interesting. I prefer the colonless form of aliasing because using colon+equals suggests variable assignment. As for your other proposal, you also suggested me of implementing indexed properties, just like C#:
property Units[id]
{
    get
    {
        return DllCall(... ..., "int", id, ... ...)
    }
}

Oh, and when I get to implement the v2 syntax I'll make a v1-to-v2 converter.

  • Guests
  • Last active:
  • Joined: --
I think your oop library and syntax is extremely useful for ahk object understand, but are you not continuing working about them? i hope new updates are close to us... Thanks..