Bob La Quey wrote:
On 10/25/07, Andrew Lentvorski <[EMAIL PROTECTED]> wrote:
Bob La Quey wrote:
I am in basic agreement with using an appropriate
scripting language whenever possible. I would say
in defense of C, after one builds up from the low
level, then one is effectively working with a scripting
languge that just has C as its syntax.
Sorry, I might agree, but I have never seen a good set of libraries for
C that matches even the basic (hash, list, vector) data structures
available in any scripting language.

Understood, but are not those underlying data structures nearly
always implemented in C? Seems somehow odd that these implementations
are good in scripting languages but not in C itself.

It's not the implementation that differs, it's the access.

Python:

somedict["key"] = 1.0

C:

hashval customhashfunc(void *key) {
   /* Convert string to hash */
}

char * key = "key";
int value = 1.0;

dict *somedict = initdict(customhashfunc);
storedict(somedict, &key, &value);
freedict(somedict);

Even if I ignore the declarations, I have to keep in mind where I need to convert what, what's a pointer, what kind of thing those pointers point to, how to convert from a pointer to a key into a hash value, etc.

Diety help me in C if I want:

somedict[("first", 1.0)] = ("second", 2.0)

The simple fact that I don't have to build a custom hash function for every silly key structure like I would in C is a big win.

No, but it is more intellectual effort to *read* no matter how well
written.  Finding a bug in 200 lines is always harder than finding one
in 10 lines--even if the 10 line program is Perl ;)

We may have to disagree about this.

Well, I'm not going to fight you ... there is a reason I use Python.

-a


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to