From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3C76A3C9.9080302@noos.fr> From: Philippe Anel User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.8) Gecko/20020209 MIME-Version: 1.0 To: 9fans <9fans@cse.psu.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: [9fans] Re: Acid Bug Date: Fri, 22 Feb 2002 21:02:17 +0100 Topicbox-Message-UUID: 54615270-eaca-11e9-9e20-41e7f4b1d025 > The documentation is wrong, although perhaps the code should be fixed > to match the documentation rather than the other way around. In fact, > I think I'll do that. > Ok. > There is not a good way to add extensions to the builtins. Coincidentally, > though, I rewrote itoa() last weekend to make it easier to control the> > format in which an integer appears. With the code below you can say, > besides the old itoa(27), itoa(27, "%x"), itoa(27, "value is %#.8x"), etc. > The format string is a general print format that a) must accept ints and > b) has the sense of %#x inverted. > I'll give it a try this weekend. > I fully acknowledge the utter hackedness of this. A better idea should > be employed. > Before your answer, I thought about adding a fmtinstall(2) like feature to builtins so we can write something like : -----------------------------------cut-here---------- complex FComplex { 'g' 0 r; 'g' 4 i; } defn Xconv(addr) { print("[", ((FComplex)addr).r, "," ((FComplex)addr).i, "]"); } fmtinstall('Y', Xconv); addr = fmt(addr, 'Y'); -----------------------------------cut-here----------- But now I feel that it is not worth the effort. Philippe,