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 04-15-2009, 04:45 PM   #1561
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

I was intending to have modules with parameters that would do some type checking (and would be like templates) and etc.

About your first point , in G.1, you can use private to belong only to the module, and names will not collide.

Quote:
The binding to private values *before* insertion in the target struct is awesome.
huh?
__________________
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 04-15-2009, 05:20 PM   #1562
Strilanc
User
 
Strilanc's Avatar
 
Join Date: Jun 2007
Posts: 917

Submissions (4)

Strilanc has a spectacular aura about (131)

2008 Spell olympics - Fire - Gold

Default

Quote:
Originally Posted by Vexorian
I was intending to have modules with parameters that would do some type checking (and would be like templates) and etc.

About your first point , in G.1, you can use private to belong only to the module, and names will not collide.

huh?

If a module is in library A and the struct is in library B, the module has access to A's private members. A simple copy-paste into the struct would give it access to B's private members.
__________________
Don't pay attention to this signature, it's self-contradictory.
Strilanc is offline   Reply With Quote
Old 04-15-2009, 05:36 PM   #1563
Strilanc
User
 
Strilanc's Avatar
 
Join Date: Jun 2007
Posts: 917

Submissions (4)

Strilanc has a spectacular aura about (131)

2008 Spell olympics - Fire - Gold

Default

Is there a way to privately implement a module? IE. only the implementer (module or struct) can access the members from the implemented module.
__________________
Don't pay attention to this signature, it's self-contradictory.
Strilanc is offline   Reply With Quote
Old 04-16-2009, 01:01 AM   #1564
SerraAvenger
User
 
Join Date: Oct 2008
Posts: 42

SerraAvenger has little to show at this moment (5)

Default

Is it a bug that structs cannot have members with the same name as (private?) globals?

it will try to rename the members in place, ie
Code:
scope TEST
globals
  private real hp
endglobals
struct
  real hp
endstruct
endscope

becomes...

Code:
scope TEST
struct
  real TEST__hp
endstruct
endscope

before the struct compiles. struct.hp, however, will not compile to struct.TEST__hp, resulting in a "undeclared member: hp" error.
SerraAvenger is offline   Reply With Quote
Old 04-16-2009, 03:09 AM   #1565
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Quote:
Originally Posted by Strilanc
Is there a way to privately implement a module? IE. only the implementer (module or struct) can access the members from the implemented module.
No, but I guess it wouldn't harm, I also think I can implement it, something like

Collapse JASS:

 struct meh
    private implement whatever
endstruct

Hope someone suggests other syntax.
__________________
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 04-16-2009, 10:47 AM   #1566
Dark_Dragon
User
 
Dark_Dragon's Avatar
 
Join Date: Apr 2008
Posts: 191

Dark_Dragon has little to show at this moment (9)

Default

i used modules they are awesome make your code much more readable and are usefull as well. However i agree as well that you should make private, protected and public so as sometimes you need to access to that member. well its only a suggestion on modules.

about other in jasshelper i would like static variables as i guess you still know:

Collapse JASS:
function any takes nothing returns nothing
    static integer var_name = 0
    set var_name = var_name + 1
    call BJDebugMessage(I2S(var_name))
endfunction

but well i dont know how hard it is so ill stop asking u!

anyway gj with ur updates +rep!
Dark_Dragon is offline   Reply With Quote
Old 04-16-2009, 02:31 PM   #1567
SerraAvenger
User
 
Join Date: Oct 2008
Posts: 42

SerraAvenger has little to show at this moment (5)

Default

Quote:
Originally Posted by Vexorian
Hope someone suggests other syntax.
I'ld generally like private and public blocks

Collapse JASS:
struct meh
    private // private block
        implement whatever
        real x
        real y
   endprivate // now default again
endstruct


What I'ld also like would be a simple 'end' syntax (think TurboPascal or ruby) instead of end[...], this is quite easy to do.
just like this:

Collapse JASS:
struct board
   private 
      real startX
      real startY
   end
   static
      constant real max_x = 4
      constant real max_y = 4
   end
end
SerraAvenger is offline   Reply With Quote
Old 04-16-2009, 02:34 PM   #1568
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Quote:
I'ld generally like private and public blocks
next suggestion please.
__________________
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 04-16-2009, 04:41 PM   #1569
Dark_Dragon
User
 
Dark_Dragon's Avatar
 
Join Date: Apr 2008
Posts: 191

Dark_Dragon has little to show at this moment (9)

Default

Quote:
Originally Posted by Vexorian
next suggestion please.

Collapse JASS:
function store takes integer a, integer b defaults 0 returns nothing
    call BJDebugMsg(I2S(a)+", "+I2S(b))
endfunction

// other function
call store(5)
it will display 5, 0

function secondexample takes constant real X returns nothing
    set X = 2 //well this can be done but you must not allow it make it inpossible to be done
endfunction

//! define set let
or 
//! define let set

function any takes nothing returns nothing
    local real x
    let x = 23.067
endfunction

just simple replace words

then this

5 > 3? call BJDebugMsg("true") : call BJDebugMsg("false")

but most important thing is to fix that what you have done allready and that is the part when interfaces and onDestroy methods create a bounch of trigger's, conditions and actions which leak in memory so just make this extra functions be at end of code and ... example 1 example worths a lot of words

Collapse JASS:

->vjass

static method create..
      this = thistype.allocate()
      call this.destroy()
endmethod

method onDestroy...

now do not create triggers, actions, conditions... just make this

->jass

function destroy blabla
    // call TriggerExecute/Evaluate(blalalla) extremly bad
   call ExecuteFunc("some_long_name")
endfunction

function some_long_name takes nothing returns nothing
    call that_on_destroy_method()
endfunction


i mean cmon why so much triggers and variables when it can be simplified a lot and ofc sleeps work in execute func if it is called from trigger...

i converted my code and looked at jass and hell thats one tone of a unneeded variables and stuff plz fix this this is a really bad way of doing this :(


well i am sry i did not ofc wanted to insult you just give some suggestions, i allready like your work so gz!

Last edited by Dark_Dragon : 04-16-2009 at 04:42 PM.
Dark_Dragon is offline   Reply With Quote
Old 04-16-2009, 05:50 PM   #1570
Strilanc
User
 
Strilanc's Avatar
 
Join Date: Jun 2007
Posts: 917

Submissions (4)

Strilanc has a spectacular aura about (131)

2008 Spell olympics - Fire - Gold

Default

Dark_Dragon, I have no idea what your suggestion is.

Vex, I'd like to restate my suggestion for one-line IFs.

Collapse JASS:
if expression then statement
//becomes
if expression then
  statement
endif

I mainly want it for guard clauses, where I have to waste three lines instead of one for simple checks.
Collapse JASS:
if i < 0 then
  return //argh! the pain of two extra lines is hurting me!
endif

It shouldn't be hard to write this in, although I don't know exactly how you go about parsing so I'm not sure. The lines can easily be identified because they begin with IF, include THEN, but don't end with THEN.
__________________
Don't pay attention to this signature, it's self-contradictory.

Last edited by Strilanc : 04-16-2009 at 05:52 PM.
Strilanc is offline   Reply With Quote
Old 04-16-2009, 06:29 PM   #1571
Alevice
It feels good
 
Alevice's Avatar
 
Join Date: Mar 2006
Posts: 1,305

Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)

Default

On that line, would be hard tio implement a conditional operator? It works like a charm wehn you don't have a way of not using multiple values for multiple conditions.
__________________
_-|-_

Alevice.jones is SC2 Beta, losers.

Check out my never updated deviantart gallery!!

Kalimdor Raiders (Race Contest #1) Pastebin Page
Cavern Crawlers (Race Contest #2) Pastebin Page
Airship Race Motherfuckers!
Quote:
Originally Posted by http://ajaxian.com/archives/would-you-like-a-_-with-that-new-library-gives-js-what-it-should-have#comment-276203
- Dont solve problems that dont exist.
- Improve the wheel, dont reinvent it.
- Port the wheel if it doesnt exist in your environment.
- Integrate the wheel into your project.
- Make sure you can replace your wooden wheel for a rubber one if someone else invents it.
Alevice is offline   Reply With Quote
Old 04-16-2009, 08:43 PM   #1572
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Quote:
Vex, I'd like to restate my suggestion for one-line IFs.
I think all that would take me is an update to the jass grammar and some extra code, but I never decided whether it is a good idea to begin changing jass syntax that much, for starters many editors with code folding will break.

Quote:
On that line, would be hard tio implement a conditional operator?
I would have to use a function call to implement it and that kinda makes it suck completely.

Quote:
Collapse JASS:
function store takes integer a, integer b defaults 0 returns nothing
    call BJDebugMsg(I2S(a)+", "+I2S(b))
endfunction

Why is it people keep suggesting things that I said I will implement?
Quote:
but most important thing is to fix that what you have done allready and that is the part when interfaces and onDestroy methods create a bounch of trigger's, conditions and actions which leak in memory so just make this extra functions be at end of code and ... example 1 example worths a lot of words

ExecuteFunc is slow.

using memory != leak.

memory incremented by static triggers and actions is negligible and much of a lesser evil in comparison to ExecuteFunc's brokeness. Also, if you don't want onDestroy to create that sort of stuff, just stop calling .destroy from above onDestroy's declaration.

Defines could happen, but not so sure, I think the inlining part of defines is completely useless stuff that is better-replaced with a good inlining algorithm. The conditional compilation part of defines, could be implemented much better at a higher level, mostly because, if I add define it won't support libraries/scopes' scoping rules and that's quite lame.

--
Since nobody is suggesting new syntax for private implement and that's really the only kind of suggestion I was asking for, how about this?

Collapse JASS:
 struct meh
    implement       private moduleName //implements moduleName's exported members as private
endstruct
__________________
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 04-16-2009, 09:33 PM   #1573
Alevice
It feels good
 
Alevice's Avatar
 
Join Date: Mar 2006
Posts: 1,305

Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)

Default

Kind of sucks that thing ofr the conditional operator. I was hoping it could be transalted to a simple if then else etc.

I thought either "private implement" or "implement private" is fine.
__________________
_-|-_

Alevice.jones is SC2 Beta, losers.

Check out my never updated deviantart gallery!!

Kalimdor Raiders (Race Contest #1) Pastebin Page
Cavern Crawlers (Race Contest #2) Pastebin Page
Airship Race Motherfuckers!
Quote:
Originally Posted by http://ajaxian.com/archives/would-you-like-a-_-with-that-new-library-gives-js-what-it-should-have#comment-276203
- Dont solve problems that dont exist.
- Improve the wheel, dont reinvent it.
- Port the wheel if it doesnt exist in your environment.
- Integrate the wheel into your project.
- Make sure you can replace your wooden wheel for a rubber one if someone else invents it.
Alevice is offline   Reply With Quote
Old 04-16-2009, 09:42 PM   #1574
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

something like
Collapse JASS:
    call UnitAddItem( IsNormalUnit(u)? (u:commander) : u, ( (level==1) ? 'I001': 'I002') )

compiler could compile into 4 if then elses, two being nested, but it wouldn't be nearly the same thing (as locals and that sort of stuff could vary due to Jass not being a state-free language (thank god it isn't a state-free language though) )


And that's what worries me, I don't want to implement a feature if it isn't the real deal.
__________________
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 04-17-2009, 04:53 AM   #1575
Strilanc
User
 
Strilanc's Avatar
 
Join Date: Jun 2007
Posts: 917

Submissions (4)

Strilanc has a spectacular aura about (131)

2008 Spell olympics - Fire - Gold

Default

Quote:
Originally Posted by Vexorian
I think all that would take me is an update to the jass grammar and some extra code, but I never decided whether it is a good idea to begin changing jass syntax that much, for starters many editors with code folding will break.

Well they won't crash, I hope, since they're already expected to work with partial mal-formed jass while you write it. Worst case scenario is the fold point being put on a one-liner or not showing up. Nothing particularly bad.
__________________
Don't pay attention to this signature, it's self-contradictory.
Strilanc 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 12:25 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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