Re: Phix type check bug
- Posted by petelomax in June
- 605 views
I suspect your main problems right now are all about the "%d".
%d - print an atom as a decimal integer (nb. truncated rather than rounded)
So if s is (say) 0.9999, it would come out as "0".
In fact, somewhat unintentionally but I'm not about to start making it crash now,
should s be {}, or indeed any sequence or string, it'll also come out as 0.
What you probably want is %v, the result of sprint(), which will handle any phix object, instead of %d.
To clarify, [s]printf() mostly mimics the C counterparts, which really only cope with numbers/strings,
whereas [s]print() [without an f] copes with any (single) phix object, of any type and nesting depth,
and the %v format specifier causes the former to invoke the latter.
PS: What I really meant to say is I will make sprintf("%d",{<not atom>}) crash if and only if
there is a pretty strong consensus on this forum to make that change, but not unilaterally.

