5 ms·
Why not add a separate, optional compilation mode that uses barriers?
by moonchild 6y ago
Why not add a separate, optional compilation mode that uses barriers?
- WalterBright 6y agoTo make it effective, you'd only want it to apply to GC pointers. But the type system does not distinguish between GC pointers and other pointers, making such a mode a rather complex implementation problem.
- moonchild 6y agoIn java-like situations where something like that would see use, I think it would be fair to treat all pointers as gc pointers.
- WalterBright 6y agoIn Java, all pointers are GC pointers. But in D, not very many are. For example, objects on the stack aren't GC pointers.
- moonchild 6y agoObjects on the stack aren't pointers at all...
- WalterBright 6y agoIf you have a struct on the stack, and call member functions, you've got pointers. For an array on the stack, taking a slice of it or looping through it with pointers, you've got pointers. For a variable on the stack, passing it by ref to another function, there are pointers.