KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: Representing dynamic typing in C A professor at my History of Computation side-lecture went into great depth about manifestly typed or type-inferred languages and generally praised the greatness of latently typed languages (faster dev times, dynamic systems, etc...). The same day, at an Automata Class, another prof says: Dynamic typing makes things more complex by adding more ways to do the same thing. I've been using statically typed languages most of my life : C/C++/Java - my only exposure to the other has been Shell Coding and Ren'Py. My question is, can I write a simple program in C that implements some of the benefits of both ? For instance, I could create Unions to accept all user driven data, like so : typedef union { int int_type; char char_type; //and so on } dynamic; // Var Creation : dynamic data; // For unknown return type void* function(dynamic data); I realize a Union could compromise type-safety, but that is what I'm trying to do here. What other approach could I take ? I'm just trying for a demonstration. I tried for an answer from this question . But honestly, I could not follow the arguments closely. I apologize if the question seems silly. PS Using suggestions from below, I wrote this : http://codepad.org/A9JAX8lD , which basically does nothing much dynamic, but is at least a start. I think I see what both my professors were trying to say.
Tags (comma-separated)
Save Edits
Cancel