Help me decide stuff

Posted by ludamad on April 5, 2009, 6:01 p.m.

Okay, while designing ludascript lots of things came up that I never had considered. Now they need to be resolved. You guys just vote on whatever options you like best.

1) Function definition:

The syntax for defining functions (for those that only use GM: GM doesn't need a function def syntax because it keeps scripts in separate files, but this only uses one file so it needs it).

A) def FuncName(arg, anotherarg){}

B) function FuncName(arg, anotherarg){}

C) FuncName(arg, anotherarg){}

D) FuncName = function(arg,anotherarg){}

E) ~FuncName??arg::anotherarg -> <-

2) Iterating 'i' from 0 to 'N'

A) for (i = 0; i <= N; i++)

B) for (i in 0:N)

C) for (i from 0 to N)

D) (FORLOOP (= i, 0) (<= i, N)(++i))

3) Globals versus locals (how the user indicates the difference)

A) global.global, local

B) $global, local

C) global, local.local

D) gGlobal, local//small g + capital means global here

E) global AS GLOBAL, local AS LOCAL

4) Arrays, by reference or by value?

A)

a = [];

b = a;

change(a);//both b and a are changed

B)

a = [];

b = a;//the contents of 'a' are expensively copied into 'b'

change(a);//only a changes

C)

a = [];

b = a;//do not allow array assignments, this errors

Okay, the last one in each is a joke. Feel free to vote for em anyway. Suggest stuff too if you'd like.

Comments

JoshDreamland 15 years, 7 months ago

B to all

sk8m8trix 15 years, 7 months ago

B, A, A, B

A in #4 is one thing I hate about java, even though it makes perfect sense to reference the same object, I think it would be more practical to reference a new one. But sometimes A can be a good thing if you need multiple variables to change, it's kinda a gamble.

ludamad 15 years, 7 months ago

sk8: Well, the idea is that either I can have it copy by ref by default and have a copy() function like this:

a = copy(b);

or have it by value by default and have some hideous way of forcing by ref. The big problem is, if its by value by default you cant pass arrays to functions which will then change them. That's why I lean to A)

Iluvfuz 15 years, 7 months ago

BAAA

ludamad 15 years, 7 months ago

global.variable is too verbose for my tastes, I don't think I'm going to use it. Besides, there is no other case where '.' is used in my language (other than for decimals)

Xxypher 15 years, 7 months ago

BAAB for sure.

ludamad 15 years, 7 months ago

I'm thinking that I should do away with semi-colons, because things can usually be inferred by context. Unsure though.

Xxypher 15 years, 7 months ago

Keep them. The more ways to do something, the better.

ludamad 15 years, 7 months ago

How would semi-colons allow more ways to do something? I mean I'm thinking of not making them manditory. Also, 'the more the better' is not always true for programming languages, can make it hard to read programs.

TDOT 15 years, 7 months ago

A, A, B, B

I think you should keep the semi-colons in, just not mandatory, like you said. For people like me who are gonna have a lot of headaches when it starts throwing errors cause I put a semi-colon after every line :p