[bitc-dev] Opinions wanted: Infix shift operators
cngilbreth at gmail.com
Mon Aug 9 16:18:09 PDT 2010
On Mon, Aug 9, 2010 at 6:42 PM, Jonathan S. Shapiro <shap at eros-os.org>wrote:
> On Mon, Aug 9, 2010 at 2:31 PM, Christopher Gilbreth <cngilbreth at gmail.com
> > wrote:
>> If you pass in the items to be formatted as a tuple, you shouldn't need to
>> overload on arity, right?
>> printf("hello %s %s %s", ("Shap", "Ben", "Chris"))
> Right. Now you need to make printf into a typeclass method and overload on
> the tuple type. One problem with this is that you can't get a type-based
> correlation between the format string and the rest of the arguments without
> a fair bit of thuggery.
> The IOStream-style syntax doesn't have this limitation, and if properly
> optimized it's potentially more efficient than the C-style streams design.
I see what you're saying, except the bit about optimization (I'll take your
word for it though). The thing I don't like about IOStreams is that it seems
it would be inconvenient for large format strings with many parameters. In
these cases I sometimes keep the format string elsewhere in the code, away
from the logic. This is particularly convenient in Python, where you can
pack the format items into a dictionary, and write e.g.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bitc-dev