-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Description
Just a random comment, not sure if anything can be done about this.
I think the mutability syntax for records is a bit unreadable.
type cpu_state = {
regs: [mut u16],
mut pc: u16,
mut sp: u16,
mut o: u16,
mem: [mut u16],
mut cycles: uint,
mut stop: bool
};
fn new_cpu_state() -> cpu_state {
{
regs: vec::to_mut(vec::from_elem(8u, 0u16)),
mut pc: 0u16,
mut sp: 0u16,
mut o: 0u16,
mem: vec::to_mut(vec::from_elem(0x10000u, 0u16)),
mut cycles: 0u,
mut stop: false
}
}
Because the mut comes before the field name, it's quite hard to figure out what the actual fields are called. IMO, name should be on the left and the information associated with it on the right, that seems like a universal thing for structs, dictionaries, etc.
Metadata
Metadata
Assignees
Labels
No labels