[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question on modification of a list via a function invocation

Steve D'Aprano wrote:
> No, they aren't first-class.

Maybe not fully, but you can do a lot more with them
than you can in Pascal or Modula-2.

> - Containers of references are not allowed.

You can't have arrays of references, but struct and class
members can be references, so you can certainly build data
structures that contain them.

(A quick experiment suggests that you can even have arrays
of structs that contain references, so I'm not sure why
they're not allowed in arrays directly.)

> - Once a reference to an object is created, it cannot be changed to 
>   reference another object ("to be reseated").

Actually there is a way to do that, but you have to be
sneaky about it.