-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Sep 29, 2005 at 07:59:01PM +1000, Erik de Castro Lopo wrote: > For just about everything you can do with a pointer in C there is > a better, easier, less error prone way to do the same thing in > O'caml and write less lines of code to do it.
How about writing a network protocol stack. You get a packet and all you know about it is that here is a block of memory. You then have to figure out what sort of packet it is, how long it is and what structure to give it. C handles this very nicely with pointers to structures that can be cast into whatever you need. > The one exception > I can thing of is writing devices drivers and operating systems > where you need to direct access to harware. If you are talking about I/O ports, you can always write a pair of functions to write and read from I/O and these can be added to any language (possibly even as inlines if the language supports that). There is no native I/O port access in C. Consider how useful functions like memcpy() and memcmp() are for writing an O/S. Consider also that an O/S is actually a form of self modifying code which strict type checking is designed to prevent. I isn't about direct hardware access, it is about having the flexibility to do what needs to be done. Try the simple exercise of writing an O'caml program that reads in a chunk of binary code from a file, and then executes that code to get a result. Less lines of code than C? - Tel -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iQIVAwUBQzxjfcfOVl0KFTApAQLhaw/+MudIVmEkOmHUGX61ILbt93q4v7uVUgpF WG9vxEReMxZMJNc/bMfAaTPI5M3p9msCgClgJnooGqGmLufToP2mmAeeGj2XXuvF abCyet6Gwr4xaFXbrboHfhWCUpDuIu7ItNQsSKaoNI/upjImA2lbV1K9sBixPfzS OTKkAWCQ+Av8ZGlYmvkiI01LRzFkIdkNbDZNDCOdJdtmsdJLzu2/dXuDscJGOQDi I48Q04zG5A4YADMCJMNQpN7GNOfPsfp6FtEKPTknJYKnOANrF2BkE9BOgXS4+kwN 7NugEOAskqmdBdfoisP/q4bdUArzSP4khdgRCtDGKSIx1hr57rUMfH+bgoswAbze fx7B8FAypyEbho4XazG+NIdQ6ez0ClnB/Dj/1fsDjxUNTPPTu9SuXIIz6Jk8ZVCP t6yyO+JgAzOZe3BgEoziSjvDpSodd3h6ORXQnmgx4FVM9oT6Qj0FXazCfN9BaFFz MBMq01mC72ISDbGSjDobfTt2XjgSXTjioQWw3hsWG8ao4OTfktyhF0Q/osd6ZAJm OyHulHuBC4e+pfycjt/U7E40iKcK2TaKm9rgQ105pmR/aLEOuD2MkKvqCVwJX2bp /vCjiNiVVzgeZvNc5bIAdtxMtr3/jvBIulsNrRJypt0QACFOfqHOQZLgmVQIHRWd Nbd/dzk/Hmc= =mpjJ -----END PGP SIGNATURE----- -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html