• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] Need help with Zinc.

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
Hey guys, I was stuck with this piece of code when I was reading the Zinc manual.
JASS:
library Test
    {
        //a function type with a single unit argument
        type unitFunc extends function(unit);

        //a function type with two integer arguments that returns boolean
        type evFunction extends function(integer,integer) -> boolean;

        function TortureUnit(unit u)
        {
            BJDebugMsg(GetUnitName(u)+" is being tortured!");
            KillUnit(u);
        }

        function HealUnit(unit u)
        {
            SetWidgetLife(u, 1000);
        }

        /* This function calls F(u) if the unit is an ally or G(u) if the unit is an enemy
         the example sucks as it is much slower than an if-else but should be good
         to explain it... */
        function AllyEnemyFunctionPicker(player p, unit u, unitFunc F, unitFunc G)
        {
            if (IsUnitAlly(u, p) ) {
                F.evaluate(u); <------------------ why use evaluate? what does F.evaluate() mean?
            } else {
                G.evaluate(u); <------------------ why use evaluate? what does G.evaluate() mean?
            }

        }

        function test(unit u)
        {
            // We are using the functions as arguments here...
            AllyEnemyFunctionPicker( Player(0), u,  TortureUnit, HealUnit );

            // will torture the unit if it is an ally, or heal it otherwise.
        }

    }

Does "unitFunc" acts like interfaces in vJass? Moreover, what does "evaluate" mean in there? Why use it? I am kinda lost.. :(
 
Yeah, it is like an interface. If you pass a function as a "unitFunc", then that function should take a unit as a parameter and return nothing.

F.evaluate(u) evaluates a function using a trigger with a trigger condition. Keep in mind that interfaces are a vJASS/Zinc feature. To call an arbitrary function, vJASS/Zinc uses a method to copy functions/evaluate them via triggers (or something like that, I forgot). That is why that feature isn't used too often in our resources--it generates a lot of additional code.

Now, in vJASS, some function interfaces might be called directly like: "call F(u)", but that doesn't mean the output code is that simple. It'll still go through evaluations and triggers and such. That is why you have to be careful with vJASS (or Zinc) and understand the underlying code. Otherwise you can end up with a lot of extra code. I remember when I was working on Ardent Heroes. I used a lot of systems, but a great deal of them didn't pay attention to the underlying code. After fixing simple things (such as the order of code), or replacing their systems with my own, I cut down on thousands of lines.

But I digress. The point is: that is the syntax. And .evaluate tells the compiler that you're attempting to call a function that follows that interface signature.
 
Level 11
Joined
Oct 11, 2012
Messages
711
Yeah, it is like an interface. If you pass a function as a "unitFunc", then that function should take a unit as a parameter and return nothing.

F.evaluate(u) evaluates a function using a trigger with a trigger condition. Keep in mind that interfaces are a vJASS/Zinc feature. To call an arbitrary function, vJASS/Zinc uses a method to copy functions/evaluate them via triggers (or something like that, I forgot). That is why that feature isn't used too often in our resources--it generates a lot of additional code.

Now, in vJASS, some function interfaces might be called directly like: "call F(u)", but that doesn't mean the output code is that simple. It'll still go through evaluations and triggers and such. That is why you have to be careful with vJASS (or Zinc) and understand the underlying code. Otherwise you can end up with a lot of extra code. I remember when I was working on Ardent Heroes. I used a lot of systems, but a great deal of them didn't pay attention to the underlying code. After fixing simple things (such as the order of code), or replacing their systems with my own, I cut down on thousands of lines.

But I digress. The point is: that is the syntax. And .evaluate tells the compiler that you're attempting to call a function that follows that interface signature.

Thanks a lot, PnF. The additional information is what I want to know. :) + 100 Rep :D
BTW: is Zinc worth learning? I have some vJass experience. Should I stick with vJass or go to Zinc?
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
I'm not Puregandfire but I think you should stick with vJASS unless you need to expand some obscure resource that's done in Zinc, as almost all the resources for JASS are in vJASS.
 
Level 11
Joined
Oct 11, 2012
Messages
711
I'm not Puregandfire but I think you should stick with vJASS unless you need to expand some obscure resource that's done in Zinc, as almost all the resources for JASS are in vJASS.

Thanks for the reply. I assume Zinc is compatible with vJass, am I wrong?
People always say Zinc is an incomplete scripting language and has bugs. I wonder what they are. Moreover, does vJass have some functions that Zinc doesn't?
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
no point in learning ZinC, its not 100% compatible to vJass (e.g. textmacros), lacks some of vjasses features (e.g. stub methods) and since its community is tiny there isnt much support.
Also the gain is low, you get a syntax which is a little bit more confortable to write, but its not worth it. If you dont like vJass then take a look at Wurst, its better than ZinC in all respects.

JASS:
type unitFunc extends function(unit);
in ZinC is a "function interface".


The vjass equivalent is:
JASS:
function interface unitFunc takes unit u returns nothing
.


Note that this is not the same as a normal (struct-) interface! If you dont understand the difference, read this: http://www.wc3c.net/vexorian/jasshelpermanual.html
 
iirc, the issue with Zinc was with static ifs. It is fine to use Zinc, and it is compatible with jasshelper/vJASS in some respects, and resources made with Zinc are approvable.

Still, most people are familiar with vJASS. I've gotten used to its verbosity. Personally, if you want a less verbose syntax, I'd go for Wurst.

edit: Beat to the post by muzzel.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
Moreover, does vJass have some functions that Zinc doesn't?

Nope, vJASS can't add new functions, since it's just syntactic sugar for writing JASS, as unfortunately we can't extend JASS without modding. In the end all these version of JASS are equivalent, in that they describe the exact same set of all valid expressions in the JASS language.

Vexorian supposedly designed vJASS to reflect the syntax and style of vanilla JASS.

I don't know much about Zinc, but it looks like Java to me. It uses braces as delimiters / scopes, and even the semicolon to mark the end of a line.

For writing really high level code, though, you probably want to brew your own additions to vJASS which you should process before passing to jasshelper. This is on the assumption you are developing in a sand box and not actually writing code in the warcraft 3 editor.

Or you could try learning Wurst, for which I believe the consensus is that it is higher level than vJASS and therefore easier to code in, which muzzel also suggests as an alternative.
 
Edit: I won't go to Wurst at the moment, coz there isn't much support yet.
I believe this is not true. Meaby if we are talking only about available "utility" resources, then yes, those are limited at the moment.

However, if you consider the fact that Wurst does not come "alone", plus the githug forum - support it here. It brings a hell lot of additional stuff that implements kind of std environment to that script language e.g tuples, lists, debug. vJass does not bring anythnig, it's naked, thats why plenty of resources has been created just to dress it up.
 
Level 11
Joined
Oct 11, 2012
Messages
711
I believe this is not true. Meaby if we are talking only about available "utility" resources, then yes, those are limited at the moment.

However, if you consider the fact that Wurst does not come "alone", plus the githug forum - support it here. It brings a hell lot of additional stuff that implements kind of std environment to that script language e.g tuples, lists, debug. vJass does not bring anythnig, it's naked, thats why plenty of resources has been created just to dress it up.

Yea, I agree. I just started learning Wurst, to me it is harder than vJass coz I have no CS background, some concept in Wurst is hard for me to easily understand, but maybe with more practice I will be fine.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Nope, vJASS can't add new functions, since it's just syntactic sugar for writing JASS, as unfortunately we can't extend JASS without modding. In the end all these version of JASS are equivalent, in that they describe the exact same set of all valid expressions in the JASS language.

Not entirely correct, languages that compile to jass surely cant magically add natives to jass, but they can add functionality. This is usually stuff that would be incredibly ugly if written in plain jass, so even though its possible people wouldnt use it. Example: structs, wurst dyn dispatch, function pointers, ...

About that "wurst is harder to learn than vjass" thingy: most basic things can be converted line by line 1:1 between vjass and wurst. Is it so much harder to write "function foo(unit u) returns string" instead of "function foo takes unit u returns string"? I really dont get the problem..
 
Level 11
Joined
Oct 11, 2012
Messages
711
Not entirely correct, languages that compile to jass surely cant magically add natives to jass, but they can add functionality. This is usually stuff that would be incredibly ugly if written in plain jass, so even though its possible people wouldnt use it. Example: structs, wurst dyn dispatch, function pointers, ...

About that "wurst is harder to learn than vjass" thingy: most basic things can be converted line by line 1:1 between vjass and wurst. Is it so much harder to write "function foo(unit u) returns string" instead of "function foo takes unit u returns string"? I really dont get the problem..

For example, its hard for me to understand the following script without the comments
JASS:
function onImpact()
        let missilePos = missile.getPos2()
        //create a big effect at location location of the missile
        Fx fx = new Fx(missilePos, angle(0), effectType)
            ..setScale(2)
            ..flash(effectType2)
        //destroy the effect after 2 seconds
        doAfter(2, () -> destroy fx)
But maybe after I thoroughly read the Wurst Manual, I can easily understand this.
Sometimes verbosity can be a good thing to newbie who has no CS background. To me, one good thing about verbosity is that it is self-explanatory. Newbies like me need to read more in order to understand what is going on. Too many dots in the script makes me lost, but that's just me, I had the same problem when I start learning vJass. It will get better as I read more and practice more. Of course for experienced coder, the more concise the better.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Well thats a piece of code that shows quite some of the "advanced" language features of wurst in very few lines (cascade operator, lambda expressions, implicit types). So its like a short showcase of all the things vJass cant do, obviously the result isnt beginner-friendly.

Wurst can look a lot more beginner-friendly, thb i havent looked at the wurstmanual lately, but i would expect that the earlier examples consist of simpler language features.
 
Level 11
Joined
Oct 11, 2012
Messages
711
Well thats a piece of code that shows quite some of the "advanced" language features of wurst in very few lines (cascade operator, lambda expressions, implicit types). So its like a short showcase of all the things vJass cant do, obviously the result isnt beginner-friendly.

Wurst can look a lot more beginner-friendly, thb i havent looked at the wurstmanual lately, but i would expect that the earlier examples consist of simpler language features.

Alright, good to know that, thanks!
Are you one of the developers of Wurst? It would be helpful for popularizing Wurst if they can integrate Wurst into WE. It took me quite some time to install and set up Eclipse and Java yesterday. :D I'm a lazy guy...
 
Level 23
Joined
Jan 1, 2009
Messages
1,615
Alright, good to know that, thanks!
Are you one of the developers of Wurst? It would be helpful for popularizing Wurst if they can integrate Wurst into WE. It took me quite some time to install and set up Eclipse and Java yesterday. :D I'm a lazy guy...

Hey, I am one of the developers.
If you have trouble setting up wurst, why don't you check out the installation instructions? https://peq.github.io/WurstScript/installation.html

Additionally, WurstWE is what you're looking for.
https://peq.github.io/WurstScript/index.html

You can find all the links on the homepage.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Keep in mind that the eclipse plugin is one of the best features of wurst, while the WurstWE triggereditor is only a semi-cool emergency feature. Sure its not very plug&play and you have to learn how to use eclipse, but its worth it.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
Not entirely correct, languages that compile to jass surely cant magically add natives to jass, but they can add functionality. This is usually stuff that would be incredibly ugly if written in plain jass, so even though its possible people wouldnt use it. Example: structs, wurst dyn dispatch, function pointers, ...

In the context of my post I was referring to extending the language in terms of actually extending JASS. In the end, as you point out, everything that vJASS / Wurst 'adds' can be done in plain JASS, though at the cost of readability. I was not referring to 'functionality' or whether vJASS can make the scripting interface easier. So I think it is correct what I said, barring the interpretation of the last clause. Indeed when I mentioned functions I meant natives, which I see now should have been clarified by me.

sethmachine said:
vJASS can't add new functions, since it's just syntactic sugar for writing JASS, as unfortunately we can't extend JASS without modding. In the end all these versions of JASS are equivalent, in that they describe the exact same set of all valid expressions in the JASS language.
 
Level 11
Joined
Oct 11, 2012
Messages
711
I really hope this "vJass or Wurst" debate, if it is a debate, can end ASAP. Let the map makers decide by themselves what to use. If your tools are good, people will eventually use them. Consider vJass and Wurst are products and the whole war3 community as a market. People won't buy your product just because you have only successfully advertised your product, you also need a decent quality product for them to use and they do know how to distinguish good and bad.
So my point is that now at least a substantial portion of the war3 community knows Wurst and vJass, the market will say by itself. I had Samsung cellphone before and now I use iPhone, but it doesn't mean I won't use Saumsung again. :)
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
If you followed the vjass/wurst "debate" then you would know that it is (in a significant extent) driven by missinformation spread by ignorant vjass advocates.
So yea, advertising on an objective, informative base does help.
 
Level 11
Joined
Oct 11, 2012
Messages
711
Noone is advertising and since this is all freeware your point doesnt stand.

It's just a metaphor, maybe I should use the word "advocating" instead of "advertising". Moreover, I didn't say only the Wurst people are advocating. Maybe I should elaborate my statement to avoid misunderstanding: the users know what to use, they won't use your tool just because how good you say it is, they know how to distinguish good and bad. The issue is the "advocating" from both sides that annoys me, not the character or quality of the things be advocated. I don't want this forum to become the battleground for the vJass people and Wurst people.

At the end I'm just a nobody, so it is wasting everyone's time trying to persuade a nobody, especially when this nobody does not want to offend anyone and uses both vJass and Wurst. :D
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
the users know what to use, they won't use your tool just because how good you say it is, they know how to distinguish good and bad.

Are you sure about that? I believe that a lot users use vJass "because everyone uses it", which isnt surprising as Jass has always been the standard. Ive seen so many people doing stupid things here, just because others do it too and they follow blindly.
I think there are some people who actually took a look a wurst and have good reasons for using or not using it. But then i think there are lots of people who think of wurst as this silly sausage project those german guys started.

Everyone should decide for himself, but its impossible to decide when people dont know both sides. Jass is well known so its our job to advertise wurst and whenever there is someone who is trying to learn wurst, it might be a good idea to show him wurst as an alternative.
 
Level 23
Joined
Jan 1, 2009
Messages
1,615
It's just a metaphor, maybe I should use the word "advocating" instead of "advertising"

The point is, that a "neutral" member (Ruke) who used vJass and Wurst opened the "debate" thread all by himself.
He evaluated both languages and found WurstScript to be far superior.

Then the usual hive-faggotry started and most of what we did wasn't "advocating", but simply pointing out facts of wurstscript and flaws in the argumentations of vJass "fanboys".

We created WurstScript, because vJass just didn't work out for us(feature, syntax and usability-wise) and we wanted something better. We don't force anyone to use it, we mostly offer.
In some threads you might define that as "advocating", but it is exactly the same how people got to know vJass, through other users suggesting it.

The problem (especially of this forum) is, as muzzel already mentioned, that most people don't know what's best (actually very similar to real life in some countries) and blatantly follow "advise" from other users of which many don't possess the skillset to give proper advise.
One example of that are many of Nes' resources that added way more work to the user, made him understand his own code less and in the end were counter-productive to the map-creation-process.

What I want are good maps. That's the main goal here many people don't seem to understand. I don't really care how you do it if it turns out good in the end, but we saw many users struggle to actually accomplish something because of various reasons.

So we created and now offer a set of tools that we think (through own experience and usage) will help every user to create a map faster and of higher quality.
But that "ideology" got lost behind the debate.

I remember the days where hivers worshipped nes' and his resources. Then someone actually evaluated them and presented, that the negative aspects outweigh the positive by a big margin.
First people were furious over those statements, and now, some months/years later many other people share the same view and it turned out to be true
 
One example of that are many of Nes' resources that added way more work to the user, made him understand his own code less and in the end were counter-productive to the map-creation-process.
I wouldn't actually say that necessarily. The new ones have a major installation problem since I've gone modularity crazy.

The old debate against Wurst was the fact that it offered limited fine control over the code. In vJASS, you can hack your way into practically everything : P. I'm not necessarily saying this is good, I'm just saying it is possible. I've done the same in c++, and I'll say this, the code is practically unreadable.

However, considering the time that Wurst saves and considering that most maps (there are only a couple of cases where I've seen that the performance gain was needed) really don't need the craziness of vJASS, I would really recommend Wurst to anyone over vJASS.

Of course, Wurst can't handle certain insane things well, like big integer arithmetic, but with the new codeless save/load synchronization algorithm that Arhowk came up with, I don't really see how insane overhead libraries like that are necessary.

Wurst also struggles on collections (I'm speaking of background code here) compared to vJASS, but c++ does too. The extra overhead gives a lot more ease of use.

In my final statement, I would say that vJASS is rich in a myriad of resources. Practically everything has been done. There is a lot less in Wurst. However, Wurst is, overall, the better language. For hacks like me, go with vJASS and screw with both the language and with other people : ).

Also, about your statement concerning me understanding my code less, I would say that that is false. I understand my code quite well. If I didn't understand it, I wouldn't have been able to code some of those crazy data structures : P.

So in the end, if you are going for something with a LOT of systems that each have a ton of overhead and need to squeeze out a lot of performance (an epic crazy map), then I would actually recommend vJASS. However, if you aren't going to need all of that, go with Wurst. I would never recommend Zinc or cJASS.

Frotty and the gang made a really great tool. It's better than Vexorian's by leaps and bounds. However, I personally still don't use it for reasons outlined above. I remember when it first came out, I was really excited about it. After reading the manual, that changed : P.

Essentially, the only good thing about vJASS is struct extends array when compared to Wurst, and that isn't necessarily an advantage depending on your stance. It's the fact that in vJASS, you can completely bypass the vJASS features and plug your own code into them.
 
Level 23
Joined
Jan 1, 2009
Messages
1,615
Wow, actually a good summary and post in general, gj nes ^)^

Also, about your statement concerning me understanding my code less, I would say that that is false. I understand my code quite well. If I didn't understand it, I wouldn't have been able to code some of those crazy data structures : P.

I wasn't talking about you, I was talking about the user. E.g to make an example of the generated code I tried to get your List module working, and it took me a while to even understand how to use it, not only because of missing documentation but also because of weird function names etc.
For bigger systems like UnitIndexing or CTL the user pretty much has no idea what is actually happening and how the code works. (espeically with extends array hackiness).

Of course, Wurst can't handle certain insane things well, like big integer arithmetic, but with the new codeless save/load synchronization algorithm that Arhowk came up with, I don't really see how insane overhead libraries like that are necessary.

There is a syncing lib in the stdlib that I used for EBR which is fast enough to sync 20-30 char strings in a few seconds. I never had problems with it and don't understand why people where calling syncing super-slow.

Wurst also struggles on collections (I'm speaking of background code here)

I created this simple example:
vJass using your List module (hopefully using it right? else correct me)
JASS:
scope Test initializer onIni
    
    struct ListTest
        unit u
        implement List
    endstruct
    
    function onIni takes nothing returns nothing
        local ListTest lt = ListTest.create()
        set lt.u = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
        call lt.enqueue()
        set lt = ListTest.create()
        set lt.u = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
        call lt.enqueue()
        set lt = ListTest.create()
        set lt.u = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
        call lt.enqueue()
        set lt = lt.list
        loop
            call RemoveUnit(lt.u)
            
            set lt = lt.next
            exitwhen lt == null
        endloop
    endfunction
endscope

Wurst with stdlib
Wurst:
package Test
import LinkedListModule

class ListTest
	unit u
	use LinkedListModule
	
	construct(unit u)
		this.u = u

	
init
	new ListTest(CreateUnit(Player(0), 'hfoo', 0,0, 0))
	new ListTest(CreateUnit(Player(0), 'hfoo', 0,0, 0))
	new ListTest(CreateUnit(Player(0), 'hfoo', 0,0, 0))
	var l = ListTest.first
	while l != null
		RemoveUnit(l.u)
		l = l.next

The generated codes:
vJass:
JASS:
constant integer si__ListTest=1
integer si__ListTest_F=0
integer si__ListTest_I=0
integer array si__ListTest_V
unit array s__ListTest_u
integer s__ListTest_List___collectionCount= 0
integer s__ListTest_List___nodeCount= 0
integer array s__ListTest_List____list
integer array s__ListTest_List____next
integer array s__ListTest_List____prev
integer array s__ListTest_List____first
integer array s__ListTest_List____last

function s__ListTest__get_list takes integer this returns integer
            return s__ListTest_List____list[this]
        endfunction
        
        function s__ListTest__get_next takes integer this returns integer
            return s__ListTest_List____next[this]
        endfunction
        
        
        function s__ListTest_List___allocateCollection takes nothing returns integer
            local integer this= s__ListTest_List____first[( 0 )]
            
            if ( 0 == this ) then
                
                set this=s__ListTest_List___collectionCount + 1
                set s__ListTest_List___collectionCount=this
            else
                set s__ListTest_List____first[( 0 )]=s__ListTest_List____first[this]
            endif
            
            return this
        endfunction
        
        function s__ListTest_List___allocateNode takes nothing returns integer
            local integer this= s__ListTest_List____next[( 0 )]
            
            if ( 0 == this ) then
                
                set this=s__ListTest_List___nodeCount + 1
                set s__ListTest_List___nodeCount=this
            else
                set s__ListTest_List____next[( 0 )]=s__ListTest_List____next[this]
            endif
            
            return this
        endfunction
        
        function s__ListTest_create takes nothing returns integer
            local integer this= s__ListTest_List___allocateCollection()
            
            
            set s__ListTest_List____first[this]=0
            
            return this
        endfunction
        function s__ListTest_enqueue takes integer this returns integer
            local integer node= s__ListTest_List___allocateNode()
            
            
            
            set s__ListTest_List____list[node]=this
        
            if ( s__ListTest_List____first[this] == 0 ) then
                set s__ListTest_List____first[this]=node
                set s__ListTest_List____last[this]=node
                set s__ListTest_List____prev[node]=0
            else
                set s__ListTest_List____next[s__ListTest_List____last[this]]=node
                set s__ListTest_List____prev[node]=s__ListTest_List____last[this]
                set s__ListTest_List____last[this]=node
            endif
            
            set s__ListTest_List____next[node]=0
            
            return node
        endfunction

    function onIni takes nothing returns nothing
        local integer lt= s__ListTest_create()
        set s__ListTest_u[lt]=CreateUnit(Player(0), 'hfoo', 0, 0, 0)
        call s__ListTest_enqueue(lt)
        set lt=s__ListTest_create()
        set s__ListTest_u[lt]=CreateUnit(Player(0), 'hfoo', 0, 0, 0)
        call s__ListTest_enqueue(lt)
        set lt=s__ListTest_create()
        set s__ListTest_u[lt]=CreateUnit(Player(0), 'hfoo', 0, 0, 0)
        call s__ListTest_enqueue(lt)
        set lt=( s__ListTest_List____list[( lt )] ) // INLINED!!
        loop
            call RemoveUnit(s__ListTest_u[lt])
            
            set lt=( s__ListTest_List____next[( lt )] ) // INLINED!!
            exitwhen lt == null
        endloop
    endfunction

Wurst:

Wurst:
unit array ListTest_u
integer LinkedListModule_first=0
integer LinkedListModule_last=0
integer LinkedListModule_size=0
integer array LinkedListModule_next
integer array ListTest_nextFree
integer ListTest_firstFree=0
integer ListTest_maxIndex=0

function alloc_ListTest takes nothing returns integer
	local integer this
	if ListTest_firstFree == 0 then
		set ListTest_maxIndex = ListTest_maxIndex + 1
		set this = ListTest_maxIndex
	else
		set ListTest_firstFree = ListTest_firstFree - 1
		set this = ListTest_nextFree[ListTest_firstFree]
	endif
	return this
endfunction

function construct_ListTest takes integer this, unit u returns nothing
	set LinkedListModule_size = LinkedListModule_size + 1
	if LinkedListModule_size == 1 then
		set LinkedListModule_first = this
	else
		set LinkedListModule_next[LinkedListModule_last] = this
	endif
	set LinkedListModule_next[this] = 0
	set LinkedListModule_last = this
	set ListTest_u[this] = u
endfunction

function new_ListTest takes unit u returns integer
	local integer this = alloc_ListTest()
	call construct_ListTest(this, u)
	return this
endfunction

function init_Test takes nothing returns nothing
	local integer l
	set LinkedListModule_first = 0
	set LinkedListModule_last = 0
	set LinkedListModule_size = 0
	call new_ListTest(CreateUnit(Player(0), 1751543663, 0., 0., 0.))
	call new_ListTest(CreateUnit(Player(0), 1751543663, 0., 0., 0.))
	call new_ListTest(CreateUnit(Player(0), 1751543663, 0., 0., 0.))
	set l = LinkedListModule_first
	loop
		exitwhen  not (l != 0)
		call RemoveUnit(ListTest_u[l])
		set l = LinkedListModule_next[l]
	endloop
endfunction

Please explain how Wurst struggles with this?
Note: this is with the (wurst) inliner turned off
 
Level 11
Joined
Oct 11, 2012
Messages
711
The point is, that a "neutral" member (Ruke) who used vJass and Wurst opened the "debate" thread all by himself.
He evaluated both languages and found WurstScript to be far superior.

Then the usual hive-faggotry started and most of what we did wasn't "advocating", but simply pointing out facts of wurstscript and flaws in the argumentations of vJass "fanboys".

We created WurstScript, because vJass just didn't work out for us(feature, syntax and usability-wise) and we wanted something better. We don't force anyone to use it, we mostly offer.
In some threads you might define that as "advocating", but it is exactly the same how people got to know vJass, through other users suggesting it.

The problem (especially of this forum) is, as muzzel already mentioned, that most people don't know what's best (actually very similar to real life in some countries) and blatantly follow "advise" from other users of which many don't possess the skillset to give proper advise.
One example of that are many of Nes' resources that added way more work to the user, made him understand his own code less and in the end were counter-productive to the map-creation-process.

What I want are good maps. That's the main goal here many people don't seem to understand. I don't really care how you do it if it turns out good in the end, but we saw many users struggle to actually accomplish something because of various reasons.

So we created and now offer a set of tools that we think (through own experience and usage) will help every user to create a map faster and of higher quality.
But that "ideology" got lost behind the debate.

I remember the days where hivers worshipped nes' and his resources. Then someone actually evaluated them and presented, that the negative aspects outweigh the positive by a big margin.
First people were furious over those statements, and now, some months/years later many other people share the same view and it turned out to be true
Well, first of all, Ruke has his bias. At least two or three people, such as looking_for_help, listed some pros about vJass, but Ruke just ignored them. But, whatever.

Frotty, I really want to know if you can make Wurst compatible with other WEs. I am a map maker in China, most of us here use a modified WE called YDWE. If a map is saved by YDWE then it cannot be opened by WurstWE because some functions from the database are missing. I think I have mentioned this in a PM to you. If it is possible for you and your team to make it compatible with Wurst, I can help you to "advertise" Wurst in our community. I have already installed eclipse, Java and downloaded the Wurst Package and I even spent some time learning it until I realized that my map couldn't be opened by WurstWE. So if this issue can be easily fixed, sure I want to keep using Wurst. But maybe that is not of your concern, why should you care about map makers in China. :D

Anyway, good work for you and your team. It is to be regretted that I cannot use it because of the reason above.
 
Level 23
Joined
Jan 1, 2009
Messages
1,615
Well, first of all, Ruke has his bias. At least two or three people, such as looking_for_help, listed some pros about vJass, but Ruke just ignored them. But, whatever.

Granted, however this bias didn't originate from one of us and I think everyone has his own biases.

Frotty, I really want to know if you can make Wurst compatible with other WEs. I am a map maker in China, most of us here use a modified WE called YDWE. If a map is saved by YDWE then it cannot be opened by WurstWE because some functions from the database are missing. I think I have mentioned this in a PM to you.

I suppose that the YDWE-Editor adds new GUI-functionality similar to what UMSWE and WEUnlimited did.

If it is possible for you and your team to make it compatible with Wurst, I can help you to "advertise" Wurst in our community. I have already installed eclipse, Java and downloaded the Wurst Package and I even spent some time learning it until I realized that my map couldn't be opened by WurstWE. So if this issue can be easily fixed, sure I want to keep using Wurst. But maybe that is not of your concern, why should you care about map makers in China. :D

I'm sure it is, if you can provide me with a copy of that editor with some english explanation.
It would be cool if you could advocate Wurst in the chinese community, because we can't (language barrier).

Of course we care, but we don't know any chinese mapper and therefore cannot know about these problems without someone telling us.
The point of this project is to make it available and useable by anyone, and for that we need help from users like you.

Anyway, good work for you and your team. It is a pity that I cannot use it because of the reason above.

it is, and it should be fixed.
We just need some information to work with. If you can provide it, it shouldn't be a problem to support YDWE-maps or at least create a tool to fix them up.

But going into this further in this thread might go too far offtopic, therefore I would suggest switching to PNs and/or instant messanging services like skype, irc or similar.

e: As you can see in our Issue tracker, a few users have reported problems that were fixed on the same day:
https://github.com/peq/WurstScript/issues/278
https://github.com/peq/WurstScript/issues/296
 
You didn't include destroy :). The list module does not use variables dedicated to allocation :). This isn't possible in Wurst. As for documentation, i have gotten better. Check UnitIndexer and DDS in the lab. I write very thorough tutorials now plus i include test cases.

Arhowk's algorithm can sync like 300 characters in 2 seconds or something. It uses ForceUIKey and ability events instead of the gamecache.

Hacks like using a variable for both allocation and other things are the only things vJASS is good for. I like my hacks, lol. In Wurst, list deallocation is O(n). In vJASS, it's O(1), so it's not as if i'm just saving a couple of variables. It's relatively significant. Unless you let people like me mess with allocation and deallixation for special cases, like lists, it will be impossible to achieve O(1) in Wurst for tge destruction of a list i'm sorry to say.

Typing on phone, so yea, typos evdrywhere
 
Level 23
Joined
Jan 1, 2009
Messages
1,615
Yes reusing the same variable is not allowed, however I don't see any indicator for wurst destroy/deallocation being O(n), please enlighten me?

JASS:
function LinkedListModule_remove takes integer this returns nothing
	set LinkedListModule_size = LinkedListModule_size - 1
	if this != LinkedListModule_first then
		set LinkedListModule_next[LinkedListModule_prev[this]] = LinkedListModule_next[this]
	endif
	if this != LinkedListModule_last then
		set LinkedListModule_prev[LinkedListModule_next[this]] = LinkedListModule_prev[this]
	endif
	if this == LinkedListModule_last then
		set LinkedListModule_last = LinkedListModule_prev[this]
	endif
	if this == LinkedListModule_first then
		set LinkedListModule_first = LinkedListModule_next[this]
	endif
endfunction

function dispatch_ListTest_remove takes integer this returns nothing
	call LinkedListModule_remove(this)
endfunction

function ListTest_onDestroy takes integer this returns nothing
	call dispatch_ListTest_remove(this)
endfunction

function dealloc_ListTest takes integer obj returns nothing
	if ListTest_typeId[obj] == 0 then
	else
		set ListTest_nextFree[ListTest_firstFree] = obj
		set ListTest_firstFree = ListTest_firstFree + 1
		set ListTest_typeId[obj] = 0
	endif
endfunction

function destroyListTest takes integer this returns nothing
	call ListTest_onDestroy(this)
	call dealloc_ListTest(this)
endfunction

There is some unnecessary dispatch added (there is an issue for that) and it has way more lines than the vJass destroy:

JASS:
        function s__ListTest_destroy takes integer this returns nothing
            



                if ( s__ListTest_List____first[this] != 0 ) then
                    set s__ListTest_List____next[s__ListTest_List____last[this]]=s__ListTest_List____next[(0)]
                    set s__ListTest_List____next[(0)]=s__ListTest_List____first[this]
                    
                    set s__ListTest_List____last[this]=0
                endif

            
            set s__ListTest_List____first[this]=s__ListTest_List____first[(0)]
            set s__ListTest_List____first[(0)]=this
        endfunction

But they would get inlined anyways (it's for errors/dynamic dispatch) and you will ultimately end up with something not much slower.
Also I was trying to recreate the most common usecase, which is in most cases adding and iterating rather than rapid removing so that it would make a difference.
 
It doesn't seem that rare to me. I would think that most of the time, when the list is destroyed, there'd be a few nodes on it. It seems pretty rare that a list would be destroyed with no nodes on it tbh. At least, from my experience.

Node destruction when a list is destroyed is kind of implied, which is why I was stating that list destruction is O(n), because it includes clearing the list.

Anyways, vJASS can do that in O(1), which is pretty significant in major operations. For example, something like Trigger wouldn't really be possible in Wurst because of the O(n) destruction. It'd hit the op limit. It's pushing the op limit as it is, lol.

Then again, how many people use this stuff? How many people will really notice a difference between O(n) and O(1) for a list? Not many, thus I'd still recommend Wurst. When it's only weakness is special cases for data structures that are unique to the JASS language, and it has many, many pros, I don't see why you wouldn't use Wurst. Of course, I love my Trigger library to say the least. To me, it's the greatest and most useful thing I've ever written. I rarely use native triggers now ; ).

Anyways, now that we have confirmed that Wurst does indeed have at least one weakness, which only means anything to power users, and that we have confirmed the fact that indeed hardly anyone is a power user (most people are in it to make games, not systems), then indeed, overall, Wurst is much better then vJASS : ).
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
Anyways, vJASS can do that in O(1), which is pretty significant in major operations. For example, something like Trigger wouldn't really be possible in Wurst because of the O(n) destruction. It'd hit the op limit. It's pushing the op limit as it is, lol.

I would not say it is impossible. You can always go back to plain arrays and get all the performance you need. For the user of the library it would not matter, whether you use arrays or "struct extends array" behind the scenes. Of course, using "struct extends array" might be a bit nicer to read and write, but that is a matter of taste (as we already discussed many times :D).
 
I would not say it is impossible. You can always go back to plain arrays and get all the performance you need. For the user of the library it would not matter, whether you use arrays or "struct extends array" behind the scenes. Of course, using "struct extends array" might be a bit nicer to read and write, but that is a matter of taste (as we already discussed many times :D).

You can use plain arrays, but then why even bother using Wurst? >.>

At least vJASS gives the pretty syntax you can sugar everything over with if you are going to bypass all of the features ; ).

Just chalk this up as a minor weakness in Wurst. It's not a big one and it doesn't effect many people. This is the only thing vJASS has over Wurst (that is known).

There is no way to create the perfect language. Wurst is good for what it does. A lot of people believe that the user should not be allowed to manipulate the inner working's of a language. This is how new languages operate. It's both a weakness and a strength, a double edged sword. The weakness in this case is special cases that can combine something like "next" with "recycler."

I think we should just let it stand as is. If you are the average user, Wurst is #1. If you are an extreme hardcore power user, you might wanna go vJASS instead. How many extreme hardcore power users can you think of that hack their way into every nook and cranny of a language? Yea, not many, so it's not even a big deal. The majority of people, the vast majority of people I should say, should use Wurst ^_^.
 
Status
Not open for further replies.
Top