Syntax for arrays?
DynamicSquid (5070)

I'm a little confuzzled on what my syntax for my language should be. Mainly when it comes to arrays.

I don't know if I want predefined functions, or built in syntax. Like this:

The built in syntax definitely looks shorter, but it doesn't really look clean when you're working with an r-value array:

I personally prefer the built in functions for r-value arrays, but the built in syntax for variables.

So which one should I chose? I can't do both

You are viewing a single comment. View All
xxpertHacker (931)

Totally random, but I barely remembered this.

You might be interested in this piece of knowledge since you're making an interpreted, memory-managed language.

JavaScript implementations, ex: V8, do not use array-like structures to store strings, instead, they use what are known as "ropes".

Some random search results:

The concept can be applied to arrays as well as strings.

DynamicSquid (5070)

@xxpertHacker Oh that's interesting, never heard of them before.

Well that took me down a data structures rabbit hole

xxpertHacker (931)

@DynamicSquid I had already conceptually thought of the idea before, but I guess it already existed, and it had a name, and it was already in use. I guess my thoughts aren't that original :(

Data structures are weird at times, I've heard of plenty, but there's an infinite more that exist.