tooltiperror
Super Moderator
- Reaction score
- 231
Or use [LJASS]code[/LJASS] ?
Ayanami:
1. So essentially, Inheritance and Interfaces in JASS pretty bad? I mean, it's very limited.
1. What do you mean with "very limited"; what do you want to do but you are unable due to jasshelper's inheritance and interfaces limitations?
Ayanami:
1. For example, you can't really do Generic Programming.
2. My idea was to treat multiple struct as a single object.
1. Generic Programming as in Generic Programming? I don't think generic programming has to do anything with inheritance. It seams to me it's just a compiler "hack" that save you a lot of typing =). So you need a generic max function then your write it once and don't bother with imax, rmax, BigIntmax, etc... Or you need a vector of ints then you do vector<int> or vector of "whatevers" (vector<whatever>) (for C++). Well it seams to me that textmacro can do that pretty easily for vJass: //! runtextmacro max("rmax", "real") and you really don't need vector for vJass cause arrays are really huge (JASS_MAX_ARRAY_SIZE ~= 8K).
Some one might find the "need" for a generic list type but you are probably just better to wrap the type in a struct and implement a list module.
I guess modules are the "remedy" for almost every oop concept there is.
2. Can you elaborate more on that point? I don't get it.
Well, seeing as every type is only an integer, why can't you do that? You just have to do some working around your initial idea. You can even do something like a module called Object that packages stuff together. Besides, that type of Abstraction isn't usually needed for JASS.
Ayanami:
1. But knowing the instance limits, I don't think this is very practical.
2. For example in Java, every Class extends the class "Object" by default.
1. I don't think that extending reduces instance limits (C extends B extends A, you can still have 8190 C's) right?
2. You can make your structs/classes extend JObject instead =). OT: I wonder why some libraries prefix their types with a single capital letter (JLabel? QString?!?! any ideas?).
I think it's a good thing that vJass has many options/features and users can do what they please, it probably doesn't always turn out to be "the best" but hey Tim Toady right =)?
interface Object
endinterface
struct A extends Object
endstruct
struct B extends Object
endstruct
[/ljass]
interface Object
endinterface
struct A extends Object
endstruct
struct B extends Object
endstruct
interface I1
endinterface
interface I2
endinterface
struct S extends I1, I2
endstruct