Discussion New Language - Discussion

Xienoph

You can change this now in User CP.
Reaction score
43
1. Not sure what you meant by free form locals. Basically, you should be able to declare local variable anywhere, not just at the start of a function block. So that's probably free form locals are.

2. Which part don't you understand? Maybe it'll help if you know what curried functions are?

Not an expert in Python, but I know enough to write a simple trace route.
 

tooltiperror

Super Moderator
Reaction score
231
Eh, the problem with free-form locals, is you need to make sure they can`t be put inside textmacros or loops. If you put a local in a textmacro and ran it a few times, it would declare the same local a few times, which would screw up the JASS.

JASS:
.
loop
set x = x + 1
local string str = "lol!"
exitwhen x = 7
endloop


Pretty much compiles to:

JASS:
.
set x = x + 1
local string str = "lol!"
set x = x + 1
local string str = "lol!"
set x = x + 1
local string str = "lol!"
set x = x + 1
local string str = "lol!"
set x = x + 1
local string str = "lol!"
set x = x + 1
local string str = "lol!"
set x = x + 1
local string str = "lol!"


And you can`t declare locals more than once.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
1. Not sure what you meant by free form locals. Basically, you should be able to declare local variable anywhere, not just at the start of a function block. So that's probably free form locals are.

2. Which part don't you understand? Maybe it'll help if you know what curried functions are?

Not an expert in Python, but I know enough to write a simple trace route.

2. I don't see the point, really...
And if you know any Python, then your more than welcome to help develop this if you'd like(as soon as it's far along enough to make it worth making it publicly developed).

Eh, the problem with free-form locals, is you need to make sure they can`t be put inside textmacros or loops. If you put a local in a textmacro and ran it a few times, it would declare the same local a few times, which would screw up the JASS.

And you can`t declare locals more than once.

Honestly, I'm not sure free-form locals are a good thing... It can make the syntax messy, which is the very last thing I want on this entire project.
 

Jesus4Lyf

Good Idea™
Reaction score
397
I see nothing wrong with freeform locals. Declaring a variable twice is picked up by PJASS and is not the compiler's problem.

When you see local type var=val in the code, move "local type var" to the top and change the line to "set var=val". This solves enough to make it useful.

EG:
JASS:
loop
set x = x + 1
local string str = "lol!"
exitwhen x = 7
endloop

-->
JASS:
local string str
loop
set x = x + 1
set str = "lol!"
exitwhen x = 7
endloop
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
If enough people want it, and if it's possible in Python, then I'll add it.
That's pretty much my stance on every feature, as long as it's a reasonable one.
 

tooltiperror

Super Moderator
Reaction score
231
cJASS Manual said:
The parser will move all local variable declarations to the beginning of the function. As in JASS2 variables can be initialized inside the declaration, cJass will also move the initialization if the variable is initialized with exact value:

cJASS Manual said:
cJass syntax also lets you declare variables of the same type on the same line, separating them by commas. These variables can also be initialized here:

That looks really pretty.

JASS:
local real x,y,nx,ny


I suggest you add in declaration, separated by semi-colons.
JASS:
.
local unit u = GetTriggerUnit()
local real x = GetUnitX(u); y = GetUnitY(u)


Just have the compiler search for 'local'. If it finds local, it will start looking for the semi-colons. If it finds a semi-colon, bump it down a line, and add local. It will also bring the type down with it. It will turn into this:
JASS:
.
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)


While we're at it, we may as well throw in a | operator. When you come across quotations, ignore what's inside, so that color codes and strings aren't effected. The | will let you whitespace without the compiler knowing.

JASS:
.
 call GetUnit|
                   X|
                      (GetTriggerUnit|
                                              ())

  // Is the same as
 call GetUnitX(GetTriggerUnit())


It looks really stupid in this example, but when you start getting into giant functions, you can split them on one line.

I`ve got a question, is parsing/compiling like working with sub/strings?
 

quraji

zap
Reaction score
144
Multiple declarations should be done like it usually is..same types can be defined on the same line and also initialized, separated by commas.
JASS:

integer i, j = 5, k, t = j
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Let's say you wanted 10 rows per player, 10 columns per row, and 10 cells per column for 12 players?

10*10*10=1000

1000*12=12000.

That's a 4d array. a 3d array of a 10x10 table for each player is 12*10*10 = 1200.

This is a very important thing, that must be implemented.

I agree, I've been waiting for something like this. Especially in combination with operator overloading.

Also, sounds crazy, but if you implement, Stay with me, Three Dimmensional Arrays, and break the size limit, you could do crazy shit.

If the size limit could be broken, don't you think it would have been broken already?

If you want 2d/3d/extended arrays, you should just compile it to use hashtables. They're slower (not that that makes much of a difference), but it makes it safer.

Freeform Locals = fail

Absolutely not. Maybe with the current syntax of using [ljass]local string str = ""[/ljass], but imagine being able to declare iterators where they're actually being used:

JASS:
integer i = 0
loop
    exitwhen i >= 12
    DisplayTextToPlayer(Player(i),0,0,"Hi, player " + I2S(i))
    i++
endloop


While we're at it, we may as well throw in a | operator. When you come across quotations, ignore what's inside, so that color codes and strings aren't effected. The | will let you whitespace without the compiler knowing.

JASS:
.
 call GetUnit|
                   X|
                      (GetTriggerUnit|
                                              ())

  // Is the same as
 call GetUnitX(GetTriggerUnit())


It looks really stupid in this example, but when you start getting into giant functions, you can split them on one line.

At the very least you should just use \ to escape the end of line. It should exist so you can put ridiculously huge functions on second and third lines for readability.


[ljass]or[/ljass] is or. Why would you want to make it less readable?

But I don't see the need for that.

Have you seen object merger textmacros? Gigantic, but if you could split it up, and put it on multiple lines, you can comment each line and explain it. This isn't specific to object merger code, as there are many instances in which you may have long arguments (such as a string that is to be displayed to a player).

For those who are offering feedback: Have you guys tried taking a look at ZINC? There's a lot of cool features in there that is lacking in the suggestions for this 'language'.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
JASS:

local real x, y, nx, ny

This.

Hudge Question: Semi-colon to be or not to be in Onyx?

Also

private / public blocks of globals. ->
JASS:

public globals
// all globals in it are public
endglobals

private globals
// all globals in it are private
endglobals

// BUT....

public globals
// Can still use private keyword
    private unit aUnit = null
    // private global
endglobals
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
> Semi-colon to be or not to be in Onyx?

For endline? I'm considering it.

> private / public blocks of globals.

What would be the point?
 

Sevion

The DIY Ninja
Reaction score
413
> private / public blocks of globals.

The point would be not having to put public or private keywords in front of all of the values.

So, instead of:

JASS:
globals
    private integer i
    private unit u
    private string s
endglobals


You could do

JASS:
private globals
    integer i
    unit u
    string s
endglobals


And compile it to the same as the first example.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
How about a configuration / endconfiguration? Or maybe just private constant global?

JASS:

configuration
    integer MAX_DAMAGE = 4
    real AREA_OF_EFFECT = 200
    string DAMAGE_MESSAGE = "the game"
endconfiguration

// becomes

globals
    private constant integer MAX_DAMAGE = 4
    private constant real AREA_OF_EFFECT = 200
    private constant string DAMAGE_MESSAGE = "the game"
endglobals
 

Sevion

The DIY Ninja
Reaction score
413
Perhaps shorten it to "config"?

I wouldn't want to make this language too complicated.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Why not just leave it out all together, and have everything private by default? Use [ljass]public[/ljass] to make something available outside the library, and 'const' to make it constant.

It's not like you create tons and tons of configurable constant variables, enough to warrant making a config block.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
I don't see the point of private by default.

Also, I'm about 80% familiar with the syntax of Python, so I can start this project soon. I just need to find out how I'm going to do the parsing (using a tool, doing it manually, etc...), and I can start working on it.
 

Xienoph

You can change this now in User CP.
Reaction score
43
Not exactly. You can modify the global you 'pass' to the function, but you can't modify that in a different thread. ForGroup calls do not break the thread.
So what happens if you modify tmpPlayer in a different thread? Is JASS smart enough to lock that variable? Or is JASS ran with JavaScript's multithreading execution model?

How does ZINC pass arguments to the anonymous function?

Lyrae said:
I don't see the point, really...
The benefits: Reusable code, less global variables (tidier code), and it makes it easier to make a spell multi player / unit / cast (Allows a unit to cast the same spell more than once?) instanceable.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
So what happens if you modify tmpPlayer in a different thread? Is JASS smart enough to lock that variable? Or is JASS ran with JavaScript's multithreading execution model?

Warcraft III runs one thread at a time. Other threads will wait for the current thread to finish before they are executed.

As for ZINC's model for passing arguments, I'm not sure. I'm not sure if it allows any to be passed at all, but it's not a big deal to set it to a global or use a function interface and wrapper func.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top