mIRC Homepage
Posted By: Kardafol Add OOP support - 03/02/07 06:32 PM
I think OOP would be a great feature for mIRC scripting.
It would allow people to code faster, make snippets that can be used more easily, etc, etc.
I think it could be implimented without breaking old scripts by:
Having a command that states that OOP will be used in the script, I.E:

Code:
alias somealias {
 OOP on

 var ^oopvar = new object(Hello World!)

 ^oopvar->hello
}

class object {
 private %msg = $1-

 public alias hello {
  echo $iif(%msg,$v1,Hi World!)
 }
}

^oopvar would be unset when the script finished.

Code:
alias somealias {
 OOP on

 set ^oopvar new object(Hello World!)

 ^oopvar->hello
}

class object {
 private %msg = $1-

 public alias hello {
  echo $iif(%msg,$v1,Hi World!)
 }
}

The object would remain, and would retain all variables set inside the object, then you could unset it by typing:
Code:
unset ^oopvar
Posted By: Riamus2 Re: Add OOP support - 03/02/07 08:41 PM
Heh. Object oriented programming has been suggested in the past and it seems that few want it. This is scripting rather than a full fledged programming language. That isn't to say it couldn't happen or that I would care if it happened. However, I can easily write any script without OOP that you can write with OOP.
Posted By: Kardafol Re: Add OOP support - 03/02/07 09:09 PM
However, if it was to be implimented the way I described, you would have to tell mIRC that the alias would be using OOP, or it would not do anything related to OOP.

Also, OOP makes it alot simpler, i.e having all the complex stuff inside the class, and having everything else outside as simple as it needs to be.
Posted By: Scripto Re: Add OOP support - 03/02/07 10:41 PM
I agree with Riamus2. I consider scripting a hobby, I enjoy this scripting process and like the editor just the way it is. It was challenging learning to write basic code from knowing nothing 5yrs ago. I just developed through trial and error. After years of using it this way, I consider myself as 'programmed' as the code and style that I use to write with, and don't think I would want to change it now... lol. I have alot of respect for Khaled creating this editor to remain simple enough for beginners to learn, yet complicated enough to remain an endless challenge. There is definately already a diversity of both low and high discipline thought process for certain scriptwriting.

I guess it all balances out on whatever level a person is willing to operate on.

To myself, I think OOP would be like mixing apples with oranges at this point. Alias's work well enough in my eyes an can achieve a similar goal. I think OOP would make scripting feel like something was missing.
Posted By: Kardafol Re: Add OOP support - 03/02/07 11:20 PM
Adding OOP the way I described would change nothing in the script editor. You would need to tell mIRC that it should use OOP in the events/etc you create.
Posted By: Scripto Re: Add OOP support - 03/02/07 11:28 PM
My point was that putting in OOP commands would be similar to replacing a good old fashioned alias...

I guess theres just some old school in me that doesn't want to see change. I feel like adding OOP is like adding something to mIRC thats already there in a sense.
Posted By: Kardafol Re: Add OOP support - 04/02/07 01:15 AM
There aren't objects, in mIRC. However, OOP is just making things more abstract. For example:

Code:
class somthing {
 alias somthing return 5
}
; could be:
alias somthing {
var %f = $1 $+ ( $+ $2- $+ )
return $somthing_ [ $+ [ %f ] ]
}
alias -l somthing_somthing return 5


alias testit {
OOP on
var ^x = new somthing
echo ^x->somthing()
echo ---
echo $somthing(somthing)
}

Still, you can't instance things this way that easily.
Theoretically, this would echo:
Quote:
5
---
5
© mIRC Discussion Forums