Hacker News new | past | comments | ask | show | jobs | submit login

I totally agree with you. I wish we had a built-in immutable array type and a built-in immutable object type. I love the way it's done in Python, where you have Lists vs Tuples and Class Objects vs NamedTuples. You can consume them the same way:

    my_list = [1,2,3] # mutable
    my_tuple = (1,2,3) # immutable
    my_clsobj = myclass(foo=1, bar=2)  # mutable
    my_namedt = mynamedt(foo=1, bar=2) # immutable

    my_list[0] # 1
    my_tuple[0] # 1
    my_clsobj.foo # 1
    my_namedt.foo # 1



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: