wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Warcraft Editing Tools
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 11-06-2009, 02:29 PM   #2941
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

Quote:
That might actually be useful. It would be good because it'd allow ifs inside of static ifs
Ifs inside static ifs are already possible.

weaaddar: I'd love type inference and have always wished to have that in vjass/zinc, hope I ever get to write the better compiler I've been planning for so long.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-06-2009, 02:32 PM   #2942
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,726

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Oh you fixed that? Cool. What about my edit?
__________________
Home Page
DoE v1.14c Download
AotZ v2.03d Download
OD v0.10x Download

Coming soon eventually...

Personal To-Do List:
ICARUS
Aot3

WC3C Chat
Chat IP: 66.103.20.109
Earthbound 2 in English
vJass Manual

"DAMAGE_TYPE_POISON motherfucker!" ~Anitarf
Rising_Dusk is offline   Reply With Quote
Old 11-06-2009, 02:36 PM   #2943
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

I never fixed that, it has always been possible to use ifs inside static ifs and vice versa.

You mean converting function ... to function interface when used in one of such arguments? I am slowly adding type safety and it will happen, really (mostly because it will allow my zinc anonymous functions to be abused in very nice ways...)
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 11-06-2009, 03:07 PM   #2944
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,726

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Vexorian
I never fixed that, it has always been possible to use ifs inside static ifs and vice versa.
Could've sworn some people reported weird bugs with it. Oh well, thanks either way.
__________________
Home Page
DoE v1.14c Download
AotZ v2.03d Download
OD v0.10x Download

Coming soon eventually...

Personal To-Do List:
ICARUS
Aot3

WC3C Chat
Chat IP: 66.103.20.109
Earthbound 2 in English
vJass Manual

"DAMAGE_TYPE_POISON motherfucker!" ~Anitarf
Rising_Dusk is offline   Reply With Quote
Old 11-06-2009, 06:08 PM   #2945
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

0.A.2.7
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 11-06-2009, 08:06 PM   #2946
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,726

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

I need to do this:
Collapse JASS:
private function HookDestroyBoolExpr takes boolexpr b returns nothing
    local integer bid = GetHandleId(b)
    if HaveSavedHandle(H, 0, bid) then
        //Clear the saved boolexpr
        call DestroyBoolExpr(LoadBooleanExprHandle(H, 0, bid))
        call RemoveSavedHandle(H, 0, bid)
    endif
endfunction

hook DestroyBoolExpr HookDestroyBoolExpr
But it will hook the other DestroyBoolExpr inside the hook function, resulting in an unwanted extra call of the function (It will not destroy the boolexpr the second time, so no infinite loop, but it does call it the function twice for no good reason). Is there any way you can add some way for us to 'disable a hook' temporarily if called inside a hook function callback?

There are workarounds, but all of them result in the hook function being called twice instead of once.
__________________
Home Page
DoE v1.14c Download
AotZ v2.03d Download
OD v0.10x Download

Coming soon eventually...

Personal To-Do List:
ICARUS
Aot3

WC3C Chat
Chat IP: 66.103.20.109
Earthbound 2 in English
vJass Manual

"DAMAGE_TYPE_POISON motherfucker!" ~Anitarf

Last edited by Rising_Dusk : 11-06-2009 at 08:12 PM.
Rising_Dusk is offline   Reply With Quote
Old 11-06-2009, 08:39 PM   #2947
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 579

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

Collapse JASS:
private function HookDestroyBoolExpr takes boolexpr b returns nothing
    local integer bid = GetHandleId(b)
    if HaveSavedHandle(H, 0, bid) then
        //Clear the saved boolexpr
//! novjass
        call DestroyBoolExpr(LoadBooleanExprHandle(H, 0, bid))
//! endnovjass
        call RemoveSavedHandle(H, 0, bid)
    endif
endfunction

hook DestroyBoolExpr HookDestroyBoolExpr

would that not work?
Bobo_The_Kodo is offline   Reply With Quote
Old 11-06-2009, 09:07 PM   #2948
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

novjass actually behaves like the <noscript> tag.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 11-07-2009, 01:48 AM   #2949
weaaddar
User


Respected User
 
Join Date: Apr 2002
Posts: 2,372

Submissions (3)

weaaddar has a spectacular aura about (131)

Default

Vex, annonymous functions still don't seem to like me much::

This throws compile errors on type even after usng the latest jasshelper,
Collapse Zinc:
//! zinc
library anony
{
    hashtable context = InitHashtable();
    type func_int_int extends function(integer)->integer;
    type Ucombinator extends function(Ucombinator)->func_int_int;

    function test()
    {
        Ucombinator U = function(Ucombinator f)->func_int_int
        {
            return f.evaluate(f);
        }
        func_int_int factorial = U.evaluate(function(Ucombinator f)->func_int_int
        {
            SaveInteger(context,0,0,integer(f));
            return function(integer n)->integer
            {
                func_int_int f = LoadInteger(context,0,0);
                FlushChildHashtable(context,0);
                if(n == 0) return 1;
                return (f.evaluate(f)).evaluate(n-1);
            }
        });
        call BJDebugMsg(I2S(factorial.evaluate(5)));
    }
}
//! endzinc

But holy crap you implemented +=? isn't that just as bad as ++?

Last edited by weaaddar : 11-07-2009 at 02:04 AM.
weaaddar is offline   Reply With Quote
Old 11-07-2009, 01:51 AM   #2950
Earth-Fury
Two Blue
 
Earth-Fury's Avatar
 
Join Date: Mar 2003
Posts: 2,178

Submissions (7)

Earth-Fury is just really nice (343)Earth-Fury is just really nice (343)Earth-Fury is just really nice (343)Earth-Fury is just really nice (343)

Send a message via MSN to Earth-Fury
Default

Quote:
Originally Posted by weaaddar
But holy crap you implemented +=? isn't that just as bad as ++?

+= is limited to assignment statements. ++ can be used in any expression. So, no, not really.
__________________
Useful Links:
My Resources:
Good Resources:
Search
Tutorials
Ability Guide

UnitMaxState
BonusMod

AutoIndex
ARGB
TimerUtils


Last edited by Earth-Fury : 11-07-2009 at 01:52 AM.
Earth-Fury is offline   Reply With Quote
Old 11-07-2009, 02:06 AM   #2951
weaaddar
User


Respected User
 
Join Date: Apr 2002
Posts: 2,372

Submissions (3)

weaaddar has a spectacular aura about (131)

Default

You know c# tends to think you're wrong sonny::
int xx = 0;
int jj = 0;
xx = jj += 5;
weaaddar is offline   Reply With Quote
Old 11-07-2009, 02:06 AM   #2952
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

I figured limiting to statements prevents giving the coders false expectations while allowing more expressive syntax.

I would add ++ as well, but when limiting it to statements, it really makes no sense not to just let it be +=1...

Code:
You know c# tends to think you're wrong sonny::
Most C-like languages allow these as expressions. But in this case, I am going python-ish with it. It is saner considering this way I don't have to deal with compiling that stuff to Jass...
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 11-07-2009, 02:09 AM   #2953
weaaddar
User


Respected User
 
Join Date: Apr 2002
Posts: 2,372

Submissions (3)

weaaddar has a spectacular aura about (131)

Default

So any idea why that code above gives me this compile error;
Line 19: Unexpected "func_int_int"?
func_int_int factorial = U.evaluate(function(Ucombinator f)->func_int_int
weaaddar is offline   Reply With Quote
Old 11-07-2009, 02:13 AM   #2954
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

this works:
Collapse Zinc:
library anony
{
    hashtable context = InitHashtable();
    type func_int_int extends function(integer)->integer;
    type Ucombinator extends function(Ucombinator)->func_int_int;

    function test()
    {
        Ucombinator U = function(Ucombinator f)->func_int_int
        {
            return f.evaluate(f);
        };
        func_int_int factorial = U.evaluate(function(Ucombinator f)->func_int_int
        {
            SaveInteger(context,0,0,integer(f));
            return function(integer n)->integer
            {
                func_int_int f = LoadInteger(context,0,0);
                FlushChildHashtable(context,0);
                if(n == 0) return 1;
                return f.evaluate(f).evaluate(n-1);
            };
        });
        BJDebugMsg(I2S(factorial.evaluate(5)));
    }
    
    function onInit()
    {
        test();
    }
}

I added some semicolons after some anonymous functions, I also removed parenthesis on return f.evaluate(f).evaluate(n-1); our beloved compiler sucks like that - it has Alzheimer and will forget the type of something if you use parenthesis, hope next time I update I remember to fix this issue...
Vexorian is offline   Reply With Quote
Old 11-07-2009, 06:18 AM   #2955
weaaddar
User


Respected User
 
Join Date: Apr 2002
Posts: 2,372

Submissions (3)

weaaddar has a spectacular aura about (131)

Default

Well, that is a funny bug. However, with some horrible pain I implemented the YCombinator in lambda expressions. Since type arguments are really ugly I kind of got lazy and just gave it a nice short name, but suffice to say the type of Y should be ugly.

Anyway, lol anonymous recursion in Zinc!
Collapse Zinc:
library anony
{
    hashtable context = InitHashtable();
    type func_int_int extends function(integer)->integer;
    type Ucombinator extends function(Ucombinator)->func_int_int;
    type Yarg extends function(func_int_int)->func_int_int;
    type Ycombinator extends function(Yarg)->func_int_int;
    
    function U(Ucombinator f)->func_int_int
    {
        return f.evaluate(f);
    }
    function test()
    {
        
        //return U(r => a => f(r(r))(a));
        Ycombinator Y = function(Yarg f)-> func_int_int
        {
            SaveInteger(context,1,0,integer(f));
            return U(function(Ucombinator r)-> func_int_int
            {
                SaveInteger(context,1,1,integer(r));
                return function(integer a)->integer
                {
                    Yarg f =LoadInteger(context,1,0);
                    Ucombinator r = LoadInteger(context,1,1);
                    return f.evaluate(U(r)).evaluate(a);
                };
            });
        };
        
        
        
        func_int_int factorial = Y.evaluate(function(Yarg f)->func_int_int
        {
            SaveInteger(context,0,0,integer(f));
            return function(integer n)->integer
            {
                func_int_int f = LoadInteger(context,0,0);
                if(n == 0) return 1;
                return n*f.evaluate(n-1);
            };
        });
        BJDebugMsg(I2S(factorial.evaluate(5)));
    }
    
    function onInit()
    {
        test();
    }
}

I made U its own function to make life easier. I suppose I could've not. And really written it out the hardcore way.

Once again, I'm completely amazed at what you've accomplished Vexorian. I've never thought I'd actually be able to write lambda expressions even if they have horrible C++0x style syntax in Jass!
weaaddar is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 09:27 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services