From: Timothy Hunter Date: 2007-01-22T10:13:03+09:00 Subject: Re: Ruby extension tutorial Wim Vander Schelden wrote: > Wim Vander Schelden schreef: >> Hi, >> >> I just finished a tutorial about writing simple ruby extensions. >> I was hoping you guys could give me some feedback on what you think >> about it. >> >> If you find any mistakes (code, spelling, grammar and explanation), I >> would also appreciate it if you told me about them? >> >> I'm looking for critisism - I hope to improve the article. Nice work! Here's a couple of nitpicks... You recommend using the "rb_" prefix on classes, modules, etc., but I'd argue that rb_-prefixed names should be reserved for things defined by Ruby itself, and your extension should use some other naming convention. You use names_array->ptr[i] to access elements in an array. My choice would be to use rb_ary_index instead, to put a little logical distance between my code and the RArray structure definition. You could use rb_ary_length to get the array size as well. Regarding "Where to go from here," another good learning resource is the C sources for the builtin classes. I frequently refer to string.c, array.c, io.c, etc. to see how things should be done.