A type and effect system for sharing