Syntax for arrays?

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

@fuzzyastrocat Now that's where things change.

If you include the length as part of the type, then it is an intricate part of the type, you cannot accept int[5] in place of an int[4].

C/C++ already have this concept though:

At that point, you might as well just degrade to using pointers.

In C, it would just automatically cast to a pointer if the function accepts int*.

In a strongly typed language, the case would have to be explicit, likely through slicing, which is what I intend to do.