Open GoogleCodeExporter opened 9 years ago
Modules aren't just macros. They are a special macro that can only be
implemented once into a struct.
Also, you can create modules using textmacros.
If you were to just make a module a definition, you'd break generated modules
and you'd break the 1 implementation thing.
Furthermore, modules have scope. Structs can't access module private members.
You can't replace it with a definition or you will break vjass modules ;p
Original comment by mrasolo...@gmail.com
on 12 Aug 2011 at 6:00
Well, thank you. And modules also may be private?
Ok:
1. I skip it, just add link -> in this line declared some module
2. Then I check, where module be implement (method or struct)
3. After code parsing I parse all modules (also tracking implenemt of nested
modules)
4. Add parsed modules to main script (use links from step 1)
This is the first thing that came to mind, but something tells me that it will
not work.
> Furthermore, modules have scope.
Give a sample please)
Original comment by adi...@gmail.com
on 12 Aug 2011 at 6:35
Example 1
scope hi
private module a
endmodule
endscope
struct tester extends array
implement a //error, module private
endstruct
Example 2
private module a
private integer h
method operator val= takes integer v returns nothing
set h=v
endmethod
method operator val takes nothing returns integer
return h
endmethod
endmodule
struct tester extends array
implement a
private static method onInit takes nothing returns nothing
set h=4 //error, h is private
set val=4 //works
endmethod
endstruct
public module members can also be accessed outside of the struct
Original comment by mrasolo...@gmail.com
on 12 Aug 2011 at 6:46
Huh, I thought that the scopes can be declared inside the modules. It would be
syntax hell)
Original comment by adi...@gmail.com
on 12 Aug 2011 at 7:04
Scopes can't be declared inside modules
Original comment by mrasolo...@gmail.com
on 12 Aug 2011 at 7:20
Yes, I undestand it) Okay... If the main specificity of the modules -
encapsulated why to write inside it infunction code like this:
module A {
DoNothing ()
}
This code processed by jassHelper well, but is we need to support it?
struct A
method foo takes nothing returns nothing
implement X
implement Y
endmethod
endstruct
module X
call DoNothing ()
endmethod
endmodule
module Y
method bar takes nothing returns nothing
endmodule
It easier to give in this case the syntax error.
Original comment by adi...@gmail.com
on 13 Aug 2011 at 6:07
module X
call DoNothing ()
endmethod
endmodule
Wrong style. Can you show me example, where it needed?
Original comment by sbratchi...@gmail.com
on 13 Aug 2011 at 6:55
Support everything that can be done by modules or you will be breaking vjass.
And yes, I use those features you just mentioned in my own systems (2 so far I
think). So yes, there are resources out there that will be incompatible with
cjass if you don't fix ; P.
Original comment by mrasolo...@gmail.com
on 13 Aug 2011 at 7:04
Well, I'm looking for other solutions to the problem...
> And yes, I use those features you just mentioned in my own systems (2 so far
I think)
Get link please (if it opensoucre) - I'm interested to see)))
Original comment by adi...@gmail.com
on 13 Aug 2011 at 7:44
http://www.thehelper.net/forums/showthread.php/166568-Timer-Utils
http://www.thehelper.net/forums/showthread.php/166641-Constant-Timer-Loop-32
I have also used modules solely for being inside of methods. The only thing I
haven't done is like a method header in a module without an endmethod ; P.
If it breaks in cJASS but not in vJASS, you have a problem regardless ;p
Original comment by mrasolo...@gmail.com
on 13 Aug 2011 at 8:54
I added new modules processing algoritm, but adic still crashes. Hmm, need to
fix it)
Original comment by adi...@gmail.com
on 15 Aug 2011 at 4:42
Try compile it with .36, it must work.
Original comment by adi...@gmail.com
on 16 Aug 2011 at 12:04
Original issue reported on code.google.com by
adi...@gmail.com
on 12 Aug 2011 at 5:34