9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Re: Acid Bug
@ 2002-02-22 20:02 Philippe Anel
  0 siblings, 0 replies; only message in thread
From: Philippe Anel @ 2002-02-22 20:02 UTC (permalink / raw)
  To: 9fans


> 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,







^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-02-22 20:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-22 20:02 [9fans] Re: Acid Bug Philippe Anel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).