News for hackers. Stuff that matters.
Re:About V, the language Volt is written in by rafaelvasco on Wednesday February 06, 2019 @10:03PM (#19102629)
This. Letting the user annotate it is better then enforcing a behavior that is adequate in some scenarios but awkward in others. For gamedev for example, generating copies at game loop is only acceptable for small objects like Vectors and if they're allocated in the stack for example. Even if the compiler optimizes it, it is better to express the intent clearly in the code.
Re:About V, the language Volt is written in by amedvednikov on Wednesday February 06, 2019 @10:07PM (#19102650)
I'm planning to optimize this so that no copies are created.
Re:About V, the language Volt is written in by rafaelvasco on Wednesday February 06, 2019 @10:10PM (#19102676)
Yeah , but i meant that a = multiply_by_2(a) still looks like it is copying things even if it isn't. Let it be immutable by default and mutable with a keyword.
Re:About V, the language Volt is written in by runeks on Thursday February 07, 2019 @10:04AM (#19105589)
For what it’s worth, if you can optimize away the immutability (copying), I’d much prefer expressing myself this way, rather than using mutability.