|
|
|
|
|
by jmillikin
5980 days ago
|
|
I agree with you regarding Perl, but you're completely wrong regarding Haskell and Python. Both languages, though high-level, allow direct unchecked access to pointers. > I would be delighted to see you cause a segfault in Haskell without taking advantage of an implementation bug. import Foreign
main = peek nullPtr
Or, more complicated but less obvious: import Data.Typeable
import Data.ByteString
data Wrap a = Wrap a
deriving (Show)
instance Typeable (Wrap a) where
typeOf _ = typeOf ()
main = let Just (Wrap bad) = cast $ Wrap () in print (bad :: ByteString)
> Python has clean indentation baked in at the implementation. All major interpreted languages don't allow you to muck around with pointers. >>> import ctypes as c
>>> c.string_at(0)
Segmentation fault
|
|
I mean really, kind of missing the point don't you think?
It's not even like Haskell makes it trivial to mutate the pointers in a natively Von Neumann-esque manner.
Monads don't count either.
Example: how often have you seen unsafe C# code (pointers) used in a production web app?
Counterpart to the above: How often do you see pointers used in C? All the time
Presenting the pathological case isn't refuting what I'm saying, it's just affirming it by showing how far you have to go out of your way to abuse your memory access, whereas in C, it's just a part of how you code. (Functors, for example.)