Re: Static vs. Dynamic typing
Re: Static vs. Dynamic typing
- Subject: Re: Static vs. Dynamic typing
- From: Oscar Morales Vivó <email@hidden>
- Date: Thu, 3 Jul 2003 12:15:05 +0200
For example C is weakly typed since it really is only operating on
chunks of bits. Whether that chunk is a integer, pointer, or part of
a string is not inherent in the value itself and you can change the
typed interpretation of a given set of bits at will.
The problem with C is not its more or less weak typing, but rather its
arbitrary rules for implicit type promotion (or, far worse, demotion).
If you want to do a static typed language, go all the way. And include
a readable typecasting operator (C++ goes halfway to solving that).
Unfortunately C++ inherits those too.
My take on this: static typing is ok as long as it doesn't make you
jump through too many hoops and can be worked around easily when needed
(i.e. not Java's typecasting & introspection hell :P). Obj-C is fine in
that aspect, as you'll get fine warnings if you use typed pointers, but
you can just use an id (or ignore the warnings) if warranted.
BTW, been fighting with C/C++ function pointers lately. God Bless
CodeWarrior's smart syntax highlighting, as otherwise I wouldn't know
where the hell is the identifier 5 minutes after writing it. Would rent
my soul to whoever could adapt the @selector syntax to C/C++ :P. Maybe
it's time to try a little macro magic... (I know, it's evil, but
sometimes the end justifies dabbling in the dark arts)
/*
Oscar Morales Vivs
Eternal Computer Science Student. Master of C++ Templates. Cocoa Nut.
Computer Graphics Scientiam Lumina. UI Guru in Training. Dabbler in all
things CS and most which are not.
Web stuff:
http://homepage.mac.com/oscarmv/index.html
*/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.