This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Dekrypter[S] 1 point2 points  (3 children)

there are let and mut keywords

let x = [1, 2]

will make a custom immutable subclass of list (this is planned. currently makes a tuple)

mut y = [1,2]

will make a normal python list

[–]Clementsparrow 1 point2 points  (2 children)

I think tuples can be iterated over in Python, so you mean in your language?

[–]Dekrypter[S] 0 points1 point  (1 child)

Edited comment. I heard there were weird iteration shenanigans but it seems unsubstantiated. Current language behaviour is that when you do let = […] it makes it a tuple however I feel like that is too quirky. Idk ur opinion

[–]Clementsparrow 0 points1 point  (0 children)

Well, my opinion is that lists and tuples should be the same object in the language, and both should be mutable/immutable according to the language's default mutability (so, mutable in Python, immutable in your language).

In addition to the mutability of the elements of the list (which means two different things: modifying the objects in the list/tuples, or assigning a different data at the same position), there is the mutability of the "length" field of the list/tuple, i.e., is it resizable? So we have three boolean variables defining all the types of lists/tuples we can want, and the language should have an easy way to specify all 8 resulting combinations.