From: Daniel Berger Date: 2006-12-04T12:02:23+09:00 Subject: Re: Redefining rb_str_init() Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Redefining rb_str_init()" > on Mon, 4 Dec 2006 08:55:08 +0900, "Daniel Berger" writes: > > |What do I need to change to make the constructor shortcut work as > |expected? > > I don't think it's a good idea to invoke function for every string > allocation. But if you really want to do, modify str_alloc() in > string.c. Well, I'm just tinkering around for now. However, I did realize something interesting. I put a printf in the str_alloc() function as you mentioned and ran an empty Ruby program. Even an empty Ruby program appears to invoke the str_alloc function 107 times! I take it there's a bunch of setup happening within the interpreter that makes a lot of calls to str_alloc() before the interpeter ever runs? That, or I've messed something up. > In general, #initialize is not called for literals. > > matz. Good to know, thanks, - Dan