[Snippet] RawCodeIndexer

Level 38
Joined
Sep 26, 2009
Messages
8,462
I always view the outputwar4map.j file, I have it perpetually open on Notepad++ so it updates whenever I save the map ;)

I use the shortest module implementations possible for what I do. You should see how much I grill Nestharus about shortening his modules. Efficiency is his thing, so he'd rather have a huge module that gives a tiny efficiency boost than a short module that works insignificantly slower.
 
Level 17
Joined
Jan 21, 2006
Messages
2,545
While interfaces may generate some jargon, extending structs doesn't (I'm pretty sure it just uses the code you are extending from). Imagine I had my Projectile library as an implementable module and then users would have to implement that into their structs and declare a special method. If you had 8 types of projectiles, that would add roughly 8,000 lines of code where only 1,000 was necessary.

They're all the same thing, I just prefer using the OO side of things because it makes more complicated scripts easier to organize and debug and maintain.
 
Level 6
Joined
Jun 20, 2011
Messages
249
Reducing code leads to trigger evaluations.
Check my missile library, there I try to keep code implemented by modules as minimal as possible, and the best thing about the whole library, not a single trigger evaluation.
Don't get me wrong, i'm not a map size freak like Bribe is, not at all, but he is right sometimes, so we try to reach that moment where the code implemented is very short and almost no performance was lost (which should be the case every time).
Extending structs to array leads to complex OOP? I differ, it merely treats the struct as it is, a scope for arrays, by deleting the default code generated by the JH, sometimes it's a need like on the LinkedListModule
 
We need to decide on an ideal API for this.
No two people have agreed on the same API yet :/

I'm going to go with a struct API and a Jass API.
Personally, I think this:

JASS:
struct RawCode extends array
    static method raw2Id takes integer returns integer
    static method id2Raw takes integer returns integer
    static method getId takes integer returns integer
endstruct

function RawCode2Id takes integer returns integer
function Id2RawCode takes integer returns integer
function GetRawCodeId takes integer returns integer
 
Top