Discussion Total JassHelper overhaul project

Should JassHelper be updated?

  • Yes

    Votes: 15 60.0%
  • No

    Votes: 6 24.0%
  • Wait for Vexorian

    Votes: 4 16.0%

  • Total voters
    25

Narks

Vastly intelligent whale-like being from the stars
make the language like java, since vjass has a lot of similarities to it
 

Bribe

vJass errors are legion
Updated the first post with a ton of new changes planned. Here's King's typecasting library in Luck:

JASS:
//////////////////////////////////////////
//       Typecasting 2.0.1
//       by kingking
//  
//  This library provides some type
//  converting functions.
//
//  ====================================
//   Functions provided :
//  ====================================
//  Agent2Widget(agent) -> widget
//  Agent2Group(agent) -> group
//  Agent2Trigger(agent) -> trigger
//  Agent2Timer(agent) -> timer
//  Agent2Location(agent) -> location
//  Agent2Effect(agent) -> effect
//  Agent2Unit(agent) -> unit
//  Agent2Item(agent) -> item
//  Widget2Unit(widget) -> unit
//  Widget2Destructable(widget) -> destructable
//  Widget2Item(widget) -> item
//
//  Due to the usage of CovertFogState in hashtable, I2X
//  is available again.
//  
//  Int2Widget(integer) -> widget
//  Int2Destructable(integer) -> destructable
//  Int2Item(integer) -> item
//  Int2Unit(integer) -> unit
//  Int2Ability(integer) -> ability
//  Int2Timer(integer) -> timer
//  Int2Trigger(integer) -> trigger
//  Int2TriggerCondition(integer) -> triggercondition
//  Int2TriggerAction(integer) -> triggeraction
//  Int2Force(integer) -> force
//  Int2Group(integer) -> group
//  Int2Location(integer) -> location
//  Int2Rect(integer) -> rect
//  Int2Sound(integer) -> sound
//  Int2Effect(integer) -> effect
//  Int2UnitPool(integer) -> unitpool
//  Int2ItemPool(integer) -> itempool
//  Int2Quest(integer) -> quest
//  Int2QuestItem(integer) -> questitem
//  Int2DefeatCondition(integer) -> defeatcondition
//  Int2TimerDialog(integer) -> timerdialog
//  Int2Leaderboard(integer) -> leaderboard
//  Int2Multiboard(integer) -> multiboard
//  Int2MultiboardItem(integer) -> multiboarditem
//  Int2Trackable(integer) -> trackable
//  Int2Dialog(integer) -> dialog
//  Int2Button(integer) -> button
//  Int2TextTag(integer) -> texttag
//  Int2Ubersplat(integer) -> ubersplat
//  Int2Region(integer) -> region
//  Int2FogState(integer) -> fogstate
//  Int2FogModifier(integer) -> fogmodifier
//////////////////////////////////////////
library Typecasting requires Array

    define DATA = Array{}
    
    public procedure Typecast{parent, return}
        ptype = lower{parent}
        rtype = lower{return}
        write
            public $rtype$ $parent$2$return$($ptype$ object)
                DATA.set$parent$(0, object)
                return DATA.get$return$(0)
    
    Typecast{"Agent", "Widget"}
    Typecast{"Agent", "Group"}
    Typecast{"Agent", "Trigger"}
    Typecast{"Agent", "Timer"}
    Typecast{"Agent", "Location"}
    Typecast{"Agent", "Effect"}
    Typecast{"Agent", "Unit"}
    Typecast{"Agent", "Item"}
    Typecast{"Widget", "Unit"}
    Typecast{"Widget", "Destructable"}
    Typecast{"Widget", "Item"} //The best one
    
    public procedure TypecastI2X{name}
        type = lower{name}
        write
            public $type$ Int2$name$(int id)
                DATA.setFogState(0, ConvertFogState(id))
                return DATA.get$name$(0)
    
    TypecastI2X{"Unit"}
    TypecastI2X{"Effect"}
    TypecastI2X{"Trigger"}
    TypecastI2X{"Timer"}
    TypecastI2X{"Widget"}
    TypecastI2X{"Group"}
    TypecastI2X{"Location"}
    TypecastI2X{"Item"}
    TypecastI2X{"Destructable"}
    TypecastI2X{"TriggerCondition"}
    TypecastI2X{"TriggerAction"}
    TypecastI2X{"Force"}
    TypecastI2X{"Rect"}
    TypecastI2X{"Sound"}
    TypecastI2X{"UnitPool"}
    TypecastI2X{"ItemPool"}
    TypecastI2X{"Quest"}
    TypecastI2X{"QuestItem"}
    TypecastI2X{"Trackable"}
    TypecastI2X{"Dialog"}
    TypecastI2X{"Button"}
    TypecastI2X{"TextTag"}
    TypecastI2X{"Image"}
    TypecastI2X{"Ubersplat"}
    TypecastI2X{"Region"}
    TypecastI2X{"FogModifier"}
 

lep

Active Member
[...]
  • Textmacros totally redefined to give maximum functionality. You can basically define your own compile-time rules now.
[...]
I'm no expert but if you want a self-programmable programming language, you should at least seek some inspiration from Lisp [1].

John Foderaro said:
Lisp is a programmable programming language.
One of the key-features of Lisp is the syntax, or rather the lack thereof.
In combination with Macros [2] you pretty much get your ,,own compile-time rules´´.

Having such a system has other interesting consequences: one could provide unit-data or even generate object-data right from your code.

Sure, the syntax is not for everybody so maybe you should have a look at Perl6 [3], Dylan [4] and Haskell [5]. Tha Haskell link stands a bit out since in Haskell you can't really define new blocks but new operators [6]. If this is a good idea one has to decide on their own.
Compiling other ideas from Haskell to $new_jass_language is probably not possible.

__________
[1] http://en.wikipedia.org/wiki/Lisp_(programming_language)
[2] http://en.wikipedia.org/wiki/Common_Lisp#Macros
[3] http://en.wikipedia.org/wiki/Perl_6_rules
[4] http://wiki.opendylan.org/wiki/view.dsp?title=Macros&v=1
[5] http://en.wikibooks.org/wiki/Haskell/More_on_functions#Infix_versus_Prefix
[6] http://www.haskell.org/haskellwiki/Ternary_operator
 

PurgeandFire

zxcvmkgdfg
That [ljass]"$var"[/ljass] thing seems kind of extraneous to me. Generally, I don't think you should add too many things like that, or else the code might lose its explicitness/readability.

In my opinion, readability is something you should constantly consider when coding this, else many people will go in disfavor of it. It looks pretty neat for the most part atm, but if too many keywords/characters become involved, it might end up having the same fate as cJASS. ;P
 

tooltiperror

Super Moderator
Staff member
>sigils @ PurgeandFire
it's a textmacro (procedure)

I always wanted to make something like this, but never had the skill.
 

PurgeandFire

zxcvmkgdfg
I was referring to this:
Placing a "$" token within a ""-type string will treat the following segment as an I2S or R2S or basic string with concatenation.
From the first post. I guess I should have been more clear. :p
 

Darthfett

Super Mod
I waited to vote on the poll, because I thought something like this was gonna happen. I personally think a lot of these changes are not good changes at all. I'd prefer to see the old vJASS syntax than this weird syntax. I think if you were to create a new poll, there would be far fewer 'yes, update it' votes, once they see that you're not merely updating the language, but making a new one.
 

Narks

Vastly intelligent whale-like being from the stars
frankly, I think that using indents to structure code is an abomination and should be killed with fire
 

Bribe

vJass errors are legion
The syntax highlighting is what kills it. When properly highlighted it is a work of beauty (Notepad++ syntax highlighting). The syntax is obviously unfinished, I still have some beautification I want to finalize with it to give it the extra nudge towards that "x" factor. For now I think I should strip out the JASS highlighting attempt so nothing looks out of place.

>> That "$var" thing seems kind of extraneous to me. Generally, I don't think you should add too many things like that, or else the code might lose its explicitness/readability.

The $ token is found in many other programming languages and makes it extremely quick to type out debug messages and also avoids very annoying syntax errors.

Code:
print "$bottles bottles of beer on the wall, $bottles bottles of beer, take one down, pass it around, $(bottles - 1) bottles of beer on the wall"
 
//versus
 
call BJDebugMsg(I2S(bottles) + "bottles bottles of beer on the wall, " + I2S(bottles) + " bottles of beer, take one down, pass it around, " + I2S(bottles - 1) + " bottles of beer on the wall")
>> I'm no expert but if you want a self-programmable programming language, you should at least seek some inspiration from Lisp.

It's going to allow far more configurable "textmacros" that JassHelper has never been able to do, but writing an entire language within Luck is not the idea.

vJass will be supported in the future, but currently I will be writing in Luck. I did not include the {} operators for blocks (I reserved those for procedures) because those are often found in hard-to-reach places on a keyboard (slowing down the writing process), especially on a German keyboard.

Yes, the poll has drifted from its original approach and for that I think I should take the poll down. By popular demand it was suggested to re-write the compiler and that's what I'm doing, deadline the end of next month for a beta at worst.

I also don't understand why anyone has a problem with indentation-based syntax... it's "unreadable"? With vJass you have to type a bunch of bloat on the screen to form endblocks and you end up having to train your eyes to ignore it. It is extremely difficult for me to read improperly indented code as it is, the endblocks have nothing to do with it. It's a nice timesaver and I think it is a very enjoyable way of writing.
 

Sevion

The DIY Ninja
The reason everyone doesn't like indentation-based syntax is because it's hard to tell where one block ends and the next starts. We're not used to seeing this and thus can't read it.

To most, the current syntax looks messy and incomplete. It's hard to read.

I say you should keep some kind of end block. Though, not just end or the current "endX" syntax. That would look weird. I think {} would seriously be the best option here.
 

Bribe

vJass errors are legion
Thank you for indicating that, I can see what you mean looking at it from that fresh perspective.

I've added colon as a requirement to open up a block statement, like Python has. It's a step in the right direction but I will be contemplating whether it is enough.
 

tooltiperror

Super Moderator
Staff member

Sevion

The DIY Ninja
I will have to agree. That does look pretty nice now. It's a pretty good idea to make Luck indentation-based as long as the blocks are easily distinguishable from each other. This will probably be good for fixing those unreadable posts without indentation :pP
 

Bribe

vJass errors are legion
Instead of indenting it eight spaces, I think it's the syntax highlighting that was making it hard to read. It looks very well-structured on my computer at home that has the Notepad++ highlighting. So for the first post, I've stripped out the syntax highlighting and it looks a lot more structured.
 

Bribe

vJass errors are legion
The rest of the readability likely has to do with TimerUtils being multi-flavored. Have you ever tried reading it in vJass? It's a mess.

Here's a Timer32 that works quite differently than what we're used to:

Code:
#luck
library T32:
    /*
        This will print "3; 2; 1" every 0.03125 seconds:
        
            struct myStruct:
                procedure PeriodicLoop():
                    write:
                        print "$this"
                
                T32{"PeriodicLoop"}
                
                onInit:
                    thistype::1.startPeriodicLoop()
                    thistype::2.startPeriodicLoop()
                    thistype::3.startPeriodicLoop()
    */
    define public T32_PERIOD = 0.03125
    
    global:
        public constant int T32_FPS  = R2I(1 / T32_PERIOD)
        public          int T32_Tick = 0
        
        trigger trig = CreateTrigger()
    
    public procedure T32(periodicName):
        include:
            thistype next
            thistype prev
            
            public nothing start$periodicName$():
                debug:
                    if this.prev != 0 or thistype::0.next == this:
                        print "T32 ERROR: Struct #$this had start$periodicName$ called while already running!"
                        return
                thistype::0.next.prev = this
                this.next = thistype::0.next
                thistype::0.next = this
            
            public nothing stop$periodicName$():
                debug:
                    if this.prev == 0 and thistype::0.next != this:
                        print "T32 ERROR: Struct #$this had stop$periodicName$ called while not running!"
                        return
                this.prev.next = this.next
                this.next.prev = this.prev
                this.prev = 0
    
            onInit:
                TriggerAddCondition(trig, Condition(lambda boolean:
                    readonly thistype this = thistype::0.next //Yeah, it's a module-readonly local variable
                    while this != 0:
                        $periodicName${}
                        this = this.next
                ))
    
    onInit:
        TimerStart(CreateTimer(), T32_PERIOD, true, lambda nothing:
            Tick++
            TriggerEvaluate(trig)
        )
#endluck
 

tooltiperror

Super Moderator
Staff member
Why make #luck? That's stupid.

You're going to be able to tell Luck from v/JASS/2 pretty easily.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    that sucks
  • jonas jonas:
    @midnight8 how is it looking
  • midnight8 midnight8:
    meh, me, wife and her friend thaty traveled with us all have covid, seems to be winding down some for me at least. Felt like complete shit, been sleeping a lot, just bieng lazy as hell. I feel like that today has probably been like 11 or 12 days since exposure. Have not had any fever today, and have not taken any meds, so hopefully by monday or tuesday I will be good to go, sadly have passed it on to our teen son, I guess that was pretty much unavoidable
  • The Helper The Helper:
    hope you get to feeling better and get vaccinated my friend
  • midnight8 midnight8:
    I will at some point, but so many vaccinated people still getting it. One of the bands we watch in vegas, all 4 had been vaccinated and are now positive.
  • Ghan Ghan:
    Symptoms?
  • Ghan Ghan:
    I think the symptoms are typically less severe if previously vaccinated.
  • midnight8 midnight8:
    I have had all of the symptoms, taste is slightly starting to come back, but smell, no. Honestly, just been a little miserable, have never felt in any danger from it. Being trapped at home sucks. lol
  • midnight8 midnight8:
    meh, got a little fever again this morning, guess gonna be a few more days
  • The Helper The Helper:
    I went to Comicon this last weekend I hope I dont get it I feel fine and I am not vaccinated and did not wear a mask
  • The Helper The Helper:
    Comicon really was not packed though like it was in the past. I am not really worried though it was the most people I have been around in a year.
  • tom_mai78101 tom_mai78101:
    Still, getting vaccinated is a good idea. We're getting Delta variant spikes here in Boston.
  • The Helper The Helper:
    I am not against vaccination at all I just have a serious procrastination problem I plan on getting vaccinated soon
  • midnight8 midnight8:
    was kinda same with me, I was gonna do it, and life got in the way.
  • midnight8 midnight8:
    we wore mask in some places, but at 118 degrees outside, little rough. :)
  • The Helper The Helper:
    yeah i had another friend in Vegas talking about that heat damn
  • The Helper The Helper:
    Well I do not think I got Covid from the Comicon
    +1
  • tom_mai78101 tom_mai78101:
    Pushed out a new Pokemon Walking algorithm build. With a new system in place, I'll probably start tackling triggers and NPCs,
    +1
  • Varine Varine:
    Is it fucking hot everywhere?
  • Varine Varine:
    What's a pokemon walking algorithm?
  • jonas jonas:
    it's an engine for pokemon games that closely emulates the walking behavior of pokemon red/blue/yellow
  • jonas jonas:
    basically if you wanted to implement pokemon yellow from scratch, and you'd want it to feel as close as possible to the real thing, you'd start with that
  • Varine Varine:
    Like from the Gameboy games? I'm not at all familiar with Pokemon.
  • jonas jonas:
    yeah
  • The Helper The Helper:
    I only played the Pokemon games on the Gamecube and Wii and such not on the portables my kids had all those games but I never really played on the portables. Now that I think about maybe once sooooo long ago.

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top