>>> Doesn't Haskell support encapsulation?
>
>> Last time I checked, Java has the same limitation.
>
> You said:
>
>>> struct Point {int x; int y;}
>> data Point = Point {x, y :: Int}
>>
>> Caution: Note that the names "x" and "y" must be unique within the
>> entire module. For this reason, you'd probably use longer names.
>
> I understand to mean that the names 'x' and 'y' in your code above
> actually garbage the global namespace.
No - the namespace of the current module. And in Java it would be the
same - the names are local to this class file.
> In the original C code they are local to 'Point' and do not affect
> anything outside it.
That's true...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|