Discussion New Language - Discussion

tooltiperror

Super Moderator
Structs are just Numbers, which is why you can only have 8192. (Or whatever it is.)

When you declare a struct, you create a number.

JASS:
.
 struct a 
 endstruct

 struct b 
 endstruct


Now, let's add in some more complications.

JASS:
.
 struct a
     string c // This will create a string array called C.
 endstruct

 struct b
     string d // This will create a string array called D.
 endstruct

 function example takes nothing returns nothing
     local a = astruct.create() // Alright, astruct is now just a number: 4 for example.
     local a = bstruct.create() // This will be five.
     set astruct.c = "Hello, there." // Now, we got a kinky little thing right here.  Here we set four in the string array C (astruct = 4, remember?) e.o our messag.
     set bstruct.c = "I hate JASS." // Now, this sets C[5] to our message.
 endfunction


You may need to work it out better than that, but that`s a basic idea.
 

Executor

I see you
Structs are just Numbers, which is why you can only have 8192. (Or whatever it is.)

When you declare a struct, you create a number.

JASS:
.
 struct a 
 endstruct

 struct b 
 endstruct


Now, let's add in some more complications.

JASS:
.
 struct a
     string c // This will create a string array called C.
 endstruct

 struct b
     string d // This will create a string array called D.
 endstruct

 function example takes nothing returns nothing
     local a = astruct.create() // Alright, astruct is now just a number: 4 for example.
     local a = bstruct.create() // This will be five.
     set astruct.c = "Hello, there." // Now, we got a kinky little thing right here.  Here we set four in the string array C (astruct = 4, remember?) e.o our messag.
     set bstruct.c = "I hate JASS." // Now, this sets C[5] to our message.
 endfunction


You may need to work it out better than that, but that`s a basic idea.
local <type> = <varname>.create() ?
local <type> <varname> = <type>.create() !
Or did you try to demonstrate a new variable declaration syntax?


@exe

The more, the worse.
The developer of the language has to choose one .... and not allow all

JASS:
nothing object.Destroy ( object s ) // object is the struct baseclass. All structs automatically  &quot;&lt; object&quot; if they are not extending another struct = )
{
   // ...
}

static object object.New ( )
{
  object new
  // allocate free index to new
  Initialize( new )
}

struct test // &lt; object <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink    ;)" data-shortname=";)" />
{
    integer X
    integer Y
}
nothing test.Destroy( test t )
{
    Super( t ) // Invokes the method of the superclass 
    // same as
    // object.Destroy( t )
}
integer test.GetY( test t ) {
    Y[ t ] + 5 // Note this***
}

initializer {
  test t = New( ) // tries to invoke test.New(), then object.New()
  BJDebugMsg( I2S( GetX( t ) ) ) // yes, getters and setters get declared automatically IF THEY AREN'T DECLARED EXPLICITELY!***
  Destroy( t )
}
Honestly? I think this is ugly
 

SerraAvenger

Cuz I can
Honestly? I think this is ugly
Might seem so, but believe me, this can be MUCH more comfortable!
Especially when you try to split up your monolithic code into M&C
Don't you forget you can declare a struct's methods ANYWHERE. Even in another namespace (as long as the struct is visible to that other namespace)
It has many other bonuses, like
  • coherent design; Used just like JASS
  • multiple classes and types may have the very same methods
  • the interface allows us to explicitely invoke a super method from the outside (look at the object.Destroy( t ), which would evoke object's Destroy method on t)
  • inner logic
  • simple parsing rules

There's a couple of things I don't like either, but I'm sure they can be changed. Most severe is this:

JASS:
static object object.New ( )
{
  object new
  // allocate free index to new
  Initialize( new ) // will try to do object.Initialize( new ) !!!
}

: /
Most easy fix:
Implicitely craft a "new" method for every type -.-
I think vjass does this. Probably, this is the only fix anyway, since index allocation has to use multiple index pools...

@TTE
Structs are just Numbers, which is why you can only have 8192. (Or whatever it is.)
No. The reason you can only have 8191 structs in older versions of vJASS was that structs are a bunch of arrays, which use the struct id as the field index to simplify quite a few things.
JASS:
local a = astruct.create()
If you want this to be the syntax, I have to admit I find it deeply illogical. It is like the bad sides of my syntax crossed with the bad sides of vJASS's syntax -.-
The implementation you suggest wouldn't work either:
JASS:
struct a 
 integer c // becomes C
endstruct
struct b
 integer c // becomes C. wait - what the?
endstruct
 

Lyerae

I keep popping up on this site from time to time.
Well, I went and typed up a big post, and then hit the "Post Quick Reply" button, and it didn't work. D:

So I'll do all that over again. :/

> small typo:

Whoops. :D

> No multiple inheritance please...

The [ljass]using * as *[/ljass] keyword will probably create an instance which can only be used if you have an instance of the struct (or class) extending the other.

> [ljass]Destroy( b )[/ljass]

Like a function call? Hmm. I'll think about that. Seems pretty good.

> How will methods/static methods be declared and used?

I haven't gotten to that part yet, but I will soon.

> Structs are just Numbers, which is why you can only have 8192. (Or whatever it is.)

I'm working on a way to use hashtables to store the index, allowing more than 8192, but that's going to wait until later.
 
I've started working on a preprocessor. I've tried before but this time I'm taking a different approach. It's going to be your typical bracket based syntax. Currently, I have only began the parsing phase, there is no syntax checker and the parser assumes all syntax is correct.

Here is an example of what I've got so far;

JASS:
scope wtf initializer x
//! gem
    constant string SOME_STRING = &quot;Hello&quot;
    nothing x(){
        integer i = GetRandomInt(0, 1)
        if (i == 1){
            BJDebugMsg(&quot;$SOME_STRING World!&quot;)
        }
    }
//! endgem
endscope


As you can see you can use (string) variables directly inside another string and it will parse. No, they do not need to be constant strings and the usage is basic, simply place the $ symbol before the name of a variable inside a string.. You may also notice that the need for call/set and other basic keywords are removed. And.. free global declartion.

I also plan to include classes like this;

JASS:
class wtf{
    
    integer x
    
    nothing print(){ BJDebugMsg(I2S(x)) }
    nothing construct(integer what){ // basically struct .create()
        this.x = what
        this.print() // Displays 5
    }
    
}

// creation
wtf = new wtf(5)



I've still got a ways to go but progress is going along nicely. So if you guys have any suggestions or want to help out just reply/pm.
 

Lyerae

I keep popping up on this site from time to time.
What language are you writing it in, and what tools are you using?
 
I'm writing it in ruby and currently nothing is required aside from having ruby installed.
So it's cross platform if that's what you're getting at.
 

Lyerae

I keep popping up on this site from time to time.
> So it's cross platform if that's what you're getting at.

No, I was just wondering what language. I've been looking to see if there is a better language than what I've been using (C++).
 

Darthfett

Aerospace/Cybersecurity Software Engineer
JASS:
scope wtf initializer x
    nothing x(){
Why do you have declare return type and what variables it takes? The initializer (which I can see is not being named inside your syntax, but instead inside regular vJass) doesn't take/return anything in any case. It makes sense to simply drop the return type and arguments.

JASS:
    constant string SOME_STRING = &quot;Hello&quot;
..
            BJDebugMsg(&quot;$SOME_STRING World!&quot;)
How would your compiler differentiate between SOME_STRING and [ljass]constant string SOME[/ljass]? While I'm not a big fan of this sort of syntax (using '+' is already the easiest and most readable way to concatenate strings), you should surround the variable name with two symbols so you can insert strings without forcing the user to place unintended spaces between variables and the rest of the string.

JASS:
class wtf{
    nothing construct(integer what){ // basically scope/library initializer
    }
}
No, that's not 'basically' a scope/library initializer. It's an instance constructor/creator/allocator method.

Why not name the method the same name as the class, require no return type (since you can't have two return types, the return of [ljass]thistype[/ljass] should be implicit in a constructor).

I like the Java 'new' keyword being used to indicate a new class is being constructed, but will you also have the option to overload a typecast call (or at least allow for multiple methods with the same name?: [ljass]wtf test = wtf(5)[/ljass]
 
Why do you have declare return type and what variables it takes? The initializer (which I can see is not being named inside your syntax, but instead inside regular vJass) doesn't take/return anything in any case. It makes sense to simply drop the return type and arguments.
..This does not rely on vJass and is not meant to be used with vJass (but possible to combine them). That's just a simple function being used as a vJass initializer. Creating something to recognize vJass initializers and give it it's own syntax is not what I am trying to do.

How would your compiler differentiate between SOME_STRING and constant string SOME? While I'm not a big fan of this sort of syntax (using '+' is already the easiest and most readable way to concatenate strings), you should surround the variable name with two symbols so you can insert strings without forcing the user to place unintended spaces between variables and the rest of the string.
I first check the entire script for globals/locals then store them. Once done I check if any of the globals are mentioned in the string then simply concentrate them. Locals are done essentially the same way, but they are function specific.

No, that's not 'basically' a scope/library initializer. It's an instance constructor/creator/allocator method.
Meh. I meant struct .create method. I haven't used jass in forever >_<

Why not name the method the same name as the class, require no return type (since you can't have two return types, the return of thistype should be implicit in a constructor).
That will be supported, but I'm going to allow constructers to have their own return type. You can make it returns 'this' if you want. I can't really see a practical reason not to make it return 'this', but why not support both?

I will probably make it default at returning 'this' though...

I like the Java 'new' keyword being used to indicate a new class is being constructed, but will you also have the option to overload a typecast call (or at least allow for multiple methods with the same name?: wtf test = wtf(5)
I haven't gotten that far into development yet. I hope to include overloading of functions and other things but I just don't know what's going to happen yet.
 

Lyerae

I keep popping up on this site from time to time.
Bump.

I'm completely redesigning the language, since the current version is... Well, meh.
I'll also be doing a lot of research on features of other languages, to see if they could be usable in Onyx.

I've also made a sub-board on my forums, so it's easier to track any kind of suggestions (and later bug reports), instead of going through a 16-page topic. Guest posting is enabled on that specific board, so you don't have to register, but you'll have to answer a simple captcha (I can't disable that.)

I'll have more updates when there's something to update.
 

tooltiperror

Super Moderator
I`m pretty interested in your code.

Also, you should add in inlining functions.

JASS:

//inline
  inline function example takes string str returns nothing
     call BJDebugMsg(str)
  endfunction

  function example takes nothing returns nothing
    call example(&quot;lol&quot;)
  endfunction


Directly compiles to

JASS:

//inline
  function example takes nothing returns nothing
      call BJDebugMsg(&quot;lol&quot;)
  endfunction
 

PrisonLove

Hard Realist
Not to be a buzzkill, but with StarCraft 2 coming out, a very large portion of the modding community will be switching over, since the new editor is supposed to be so much better. I just don't know if you'd want to spend all this time developing a new language, just to have everyone shift over by the time, or before, you're finished.

Just something to keep in mind, that's all. Sorry I have nothing constructive to add.
 

Lyerae

I keep popping up on this site from time to time.
I thought the same thing. I've actually thought about it for about a month now.
I'm going to still develope a JASS version, but as soon as SC2 comes out, I'll be dropping the JASS version. Earlier if Galaxy is any good.

Hell, I won't even work on a JASS version if I get the beta with the editor. I'll just work entirely on Galaxy.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Friday Yay!
  • mgarcia mgarcia:
    did you guys catch Carl's interview? https://www.youtube.com/watch?v=kuHiMXABkGs
  • mgarcia mgarcia:
    he's the one that informed me about the DVD's working!
  • mgarcia mgarcia:
    he also mentioned the progress on the controllers!
  • The Helper The Helper:
    I did actually it was cool to see the NUON mention
  • The Helper The Helper:
    https://discord.com/channels/985377399338332202/985377399950696481 you can still use this chat too we are two fisted now :)
  • thewrongvine thewrongvine:
    costs me $80 to fill gas tank sad face
  • Ghan Ghan:
    Oof
  • The Helper The Helper:
    Yeah that gas is some expensive stuff :)
  • The Helper The Helper:
    ghan does not have to worry about it he has a tesla and I have a small tank so it does not cost me usually more than 50
  • The Helper The Helper:
    fyi Ghan we are getting an error trying to access stats or world editor tutorials Error 526 Ray ID: 72128c6bf99f6707 • 2022-06-26 02:35:15 UTCInvalid SSL certificate
  • Ghan Ghan:
    An artifact of switching to Cloudflare... the Let's Encrypt certs can't autorenew through Cloudflare.
  • Ghan Ghan:
    I got the forum updated before things expired but there were some other casualties.
  • Ghan Ghan:
    Everything should be fixed now....
  • The Helper The Helper:
    Thank you Ghan!
  • The Helper The Helper:
    Happy Monday!
  • The Helper The Helper:
    new NUON forum mod cubanral!
    +1
  • The Helper The Helper:
  • tom_mai78101 tom_mai78101:
    Started learning how to make tools-assisted speedruns, so I'm lately busy.
  • tom_mai78101 tom_mai78101:
    Here's my current project.
    +3
  • O Old Mountain Shadow:
    that was pretty good!
  • jonas jonas:
    really cool! I saw the game before but always thought it's just a half as good double dragon. Now I realize it actually has a lot of depth!
  • The Helper The Helper:
    I just saw a bunch of running and jumping past all the enemies look like it was scripted as he said I guess I should have watched the whole thing. I only got a couple of minutes in. You should post that video in the forum Tom
  • Darthfett Darthfett:
    "Hi in the chat!"
    +1
  • tom_mai78101 tom_mai78101:
    Currently busy with making the run even better, so I'll post that new one once I'm done. Right now, I had to modify the emulator itself, the tools that makes this video, and some RAM address disassembling / reverse-engineering to get the right values, and such.
    +1

    Staff online

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top