Discussion New Language - Discussion

tooltiperror

Super Moderator
Reaction score
231
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
Reaction score
57
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    ;)" loading="lazy" 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&#039;T DECLARED EXPLICITELY!***
  Destroy( t )
}

Honestly? I think this is ugly
 

SerraAvenger

Cuz I can
Reaction score
234
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.
Reaction score
105
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.
 
Reaction score
341
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.
Reaction score
105
What language are you writing it in, and what tools are you using?
 
Reaction score
341
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.
Reaction score
105
> 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
Reaction score
615
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]
 
Reaction score
341
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.
Reaction score
105
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
Reaction score
231
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
Reaction score
78
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.
Reaction score
105
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.
 

tooltiperror

Super Moderator
Reaction score
231
And just do the compiler. The IDE could be moonlite aswell.

I was thinking about that, too.

According to Vestras, you should be able to create a custom file of some sort to make your own language, I think.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • 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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top