On Mon, 15 Nov 2004, John Goerzen wrote:
Here are some examples:
vsprintf Hello
Hello
vsprintf Hello, %s\n John
Hello, John\n
vsprintf %s, your age is %d\n John (10::Integer)
John, your age is 10\n
sprintfAL %(name)s, your age is %(age)d\n
[(name, v John),
(age, v
Henning Thielemann writes:
Variable length argument lists are really a mess. Why are
people so keen on them?
One advantage is that you need to type fewer characters.
It's, well, not _that_ important, I'll readily admit. :-)
But
vsnprintf i = %d;\tj = %s 12 test
is more compact than any
On 16 Nov 2004, Peter Simons wrote:
Henning Thielemann writes:
Variable length argument lists are really a mess. Why are
people so keen on them?
One advantage is that you need to type fewer characters.
I know memory is expensive, that's why only the last two digits of year
numbers
At the risk of getting off topic... the reason 'C' has printf is because
it is not
polymorphic. Printf is a hack to allow different types to be printed
out, such that
they did not need printInt, printFloat etc. Remember C is typesafe, so
the only
way they could do this was to pass the first
Keean Schupke wrote:
Remember C is typesafe
In which parallel universe?
--
Andreas Rossberg, [EMAIL PROTECTED]
Let's get rid of those possible thingies! -- TB
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
On 2004-11-16 at 11:42+0100 Peter Simons wrote:
Henning Thielemann writes:
One advantage is that you need to type fewer characters.
I know memory is expensive, that's why only the last two
digits of year numbers are stored. :-]
I understand what you're getting at -- and I find it
Andreas Rossberg wrote:
Keean Schupke wrote:
Remember C is typesafe
In which parallel universe?
I of course meant strongly-typed, you cannot pass a pointer to an int
where a pointer
to a float is required ... modern C compilers require you to explicitly
cast. Where
it fell down was all that
Actually it can be statically checked, as the string is a constant, we can
lift it to a type (at the moment we would have to use template haskell - but
there is no reason the compiler cannot be a little more aggresive in
applying
functions to constants at compile time, in which case we can use
On Tue, Nov 16, 2004 at 12:21:41PM +0100, Henning Thielemann wrote:
The function MissingH.Printf.sprintf is probably the better choice, but
one could even replace [Value] by [String]. The conversion from any type
to String can be easily done using 'show' by the caller. Though it gives
the
Keean Schupke wrote:
At the risk of getting off topic... the reason 'C' has printf is because
it is not polymorphic. Printf is a hack to allow different types to be
printed out, such that they did not need printInt, printFloat etc.
Many language have printf-like functions despite not satisfying
Jon Fairbairn writes:
vsprintf %d, your age is %s\n John (10::Integer)
is type incorrect, but won't be reported at compile time.
Hmmm. Right. You'd need Template Haskell for that.
I see.
Peter
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
Ben Rudiak-Gould wrote:
Keean Schupke wrote:
At the risk of getting off topic... the reason 'C' has printf is because
it is not polymorphic. Printf is a hack to allow different types to be
printed out, such that they did not need printInt, printFloat etc.
Many language have printf-like
Keean Schupke wrote:
I of course meant strongly-typed, you cannot pass a pointer to an int
where a pointer
to a float is required ... modern C compilers require you to explicitly
cast.
According to the C standard,
void f(float *p) { *p + 1.0; }
void g(void *p) { f(p); }
void h(int n) {
Of course you can do intertationalisation with show... There is a
paper on using type classes to define implicit confugurations,
perhasps someone can provide the reference?
This can be used to nicely redefine show... Ill see if I cant
dig out an example.
Keean.
On 2004 November 16 Tuesday 06:42, Jérémy Bobbio wrote:
There is a probleme with ShowS though: it is not internationalizable at
all. Strings like printf's or with any kind of variable substitution is
required for proper internationalization / localization.
Printf is not adequate for
On 2004-11-16, Henning Thielemann [EMAIL PROTECTED] wrote:
On 16 Nov 2004, Peter Simons wrote:
Yes and no. It can't be checked statically if the number of placeholders
matches the number of arguments. It can't be checked statically if the
types of placeholders match the types of arguments. It
On 2004-11-16, Peter Simons [EMAIL PROTECTED] wrote:
I know memory is expensive, that's why only the last two
digits of year numbers are stored. :-]
I understand what you're getting at -- and I find it
annoying, too, when people sacrifice robustness for comfort.
In this particular case,
On 2004-11-16, Jon Fairbairn [EMAIL PROTECTED] wrote:
On 2004-11-16 at 11:42+0100 Peter Simons wrote:
I'm not sure, though, whether this is the case here, because
vsnprintf in Haskell still is type-safe.
Not statically, though, surely?
vsprintf %d, your age is %s\n John (10::Integer)
is
On 2004 November 16 Tuesday 06:42, Jérémy Bobbio wrote:
There is a probleme with ShowS though: it is not internationalizable at
all. Strings like printf's or with any kind of variable substitution is
required for proper internationalization / localization.
Printf is not adequate for
19 matches
Mail list logo