www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Write/Writeln, etc

reply bearophile <bearophileHUGS lycos.com> writes:
std.metastrings.Format of D 2.029 is broken, I think.

--------------------

The following doesn't work, the pragma isn't seen as an instruction, I guess
this is normal, but I don't like it much:

static if (true)
    pragma(msg, "true");
else
    pragma(msg, "false");

--------------------

D2 programs need more and more compile-time printing, and:
pragma(msg, ToString(...) ~ ...);
isn't much nice.

So I think that the std.metastrings.Write and std.metastrings.Writeln templates
may be created, able to print strings, integral values, floating point values,
and arrays of those types.

I have started to create such templates, but to create the
std.metastrings.Write I have seen I'd like to have a pragma(msg, ...) that
doesn't add a newline at the end.

Has someone written a template or compile-time-function able to print a
floating point value?

Bye,
bearophile
May 07 2009
next sibling parent BCS <ao pathlink.com> writes:
Reply to bearophile,

 std.metastrings.Format of D 2.029 is broken, I think.
 
 --------------------
 
 The following doesn't work, the pragma isn't seen as an instruction, I
 guess this is normal, but I don't like it much:
 
 static if (true)
 pragma(msg, "true");
 else
 pragma(msg, "false");
 --------------------
 
 D2 programs need more and more compile-time printing, and:
 pragma(msg, ToString(...) ~ ...);
 isn't much nice.
 So I think that the std.metastrings.Write and std.metastrings.Writeln
 templates may be created, able to print strings, integral values,
 floating point values, and arrays of those types.
 
 I have started to create such templates, but to create the
 std.metastrings.Write I have seen I'd like to have a pragma(msg, ...)
 that doesn't add a newline at the end.
 
 Has someone written a template or compile-time-function able to print
 a floating point value?
 
 Bye,
 bearophile
http://www.dsource.org/projects/ddl/browser/trunk/meta/conv.d
May 07 2009
prev sibling parent reply Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
On Thu, May 7, 2009 at 1:38 PM, bearophile <bearophileHUGS lycos.com> wrote=
:

 The following doesn't work, the pragma isn't seen as an instruction, I gu=
ess this is normal, but I don't like it much:
 static if (true)
 =A0 =A0pragma(msg, "true");
 else
 =A0 =A0pragma(msg, "false");
Funny, I just ran into that today too. If you add braces, for some reason it works.
 D2 programs need more and more compile-time printing, and:
 pragma(msg, ToString(...) ~ ...);
 isn't much nice.
Once again: 'much' and 'too much' can never. modify. adjectives. They are not adverbs.
May 07 2009
next sibling parent reply Derek Parnell <derek psych.ward> writes:
On Thu, 7 May 2009 16:02:52 -0400, Jarrett Billingsley wrote:

 Once again: 'much' and 'too much' can never.
 
 modify.
 
 adjectives.
 
 They are not adverbs.
Really? Have consulted the "superdan" on that? Also, I note that you have some sentences written without subject or verb, or object, and without leading upper case character. As far as I know, only e.e.cummings can get away with that, then only just. ;-) -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
May 07 2009
parent superdan <super dan.org> writes:
Derek Parnell Wrote:

 On Thu, 7 May 2009 16:02:52 -0400, Jarrett Billingsley wrote:
 
 Once again: 'much' and 'too much' can never.
 
 modify.
 
 adjectives.
 
 They are not adverbs.
Really? Have consulted the "superdan" on that?
huh? wut? wut about me? if i type in vernacular doesn't know i dunno grammar 'n' spelling 'n' shit.
 Also, I note that you have some sentences written without subject or verb,
 or object, and without leading upper case character.  As far as I know,
 only e.e.cummings can get away with that, then only just. ;-)
me, i'd be happy if nick stopped spellin' 'depricated'.
May 07 2009
prev sibling next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Jarrett Billingsley:

If you add braces, for some reason it works.<
I think that if you don't put braces the compiler sees: static if (true) else If you put them it sees: static if (true) {} else {} The first isn't correct D code. But I'd like the pragma to be seen as an instruction anyway by the static if.
 Once again: 'much' and 'too much' can never.
 modify.
 adjectives.
 They are not adverbs.
Thank you. My English text reviewers surely get headaches. Bye, bearophile
May 07 2009
prev sibling parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 07 May 2009 16:02:52 -0400, Jarrett Billingsley  
<jarrett.billingsley gmail.com> wrote:

 On Thu, May 7, 2009 at 1:38 PM, bearophile <bearophileHUGS lycos.com>  
 wrote:

 The following doesn't work, the pragma isn't seen as an instruction, I  
 guess this is normal, but I don't like it much:

 static if (true)
    pragma(msg, "true");
 else
    pragma(msg, "false");
Funny, I just ran into that today too. If you add braces, for some reason it works.
 D2 programs need more and more compile-time printing, and:
 pragma(msg, ToString(...) ~ ...);
 isn't much nice.
Once again: 'much' and 'too much' can never. modify. adjectives. They are not adverbs.
Much. can be. an adverb. http://www.merriam-webster.com/dictionary/much%5B2%5D Besides, who really cares if people use incorrect grammar? We aren't turning in essay papers here. Bearophile, what you meant to say was "isn't much nicer". -Steve
May 08 2009
parent reply Georg Wrede <georg.wrede iki.fi> writes:
Steven Schveighoffer wrote:
 On Thu, 07 May 2009 16:02:52 -0400, Jarrett Billingsley 
 <jarrett.billingsley gmail.com> wrote:
 
 On Thu, May 7, 2009 at 1:38 PM, bearophile <bearophileHUGS lycos.com> 
 wrote:

 The following doesn't work, the pragma isn't seen as an instruction, 
 I guess this is normal, but I don't like it much:

 static if (true)
    pragma(msg, "true");
 else
    pragma(msg, "false");
Funny, I just ran into that today too. If you add braces, for some reason it works.
 D2 programs need more and more compile-time printing, and:
 pragma(msg, ToString(...) ~ ...);
 isn't much nice.
Once again: 'much' and 'too much' can never. modify. adjectives. They are not adverbs.
Much. can be. an adverb. http://www.merriam-webster.com/dictionary/much%5B2%5D Besides, who really cares if people use incorrect grammar? We aren't turning in essay papers here. Bearophile, what you meant to say was "isn't much nicer".
Or "isn't very nice". (At least, if looking at bearophile's regular use of that phrase. Could it be that "very" and "much" are the same word in Italian?) Not that I care, English isn't my first language, either. ;-)
May 08 2009
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Fri, 08 May 2009 08:28:28 -0400, Georg Wrede <georg.wrede iki.fi> wrote:

 Steven Schveighoffer wrote:
 On Thu, 07 May 2009 16:02:52 -0400, Jarrett Billingsley  
 <jarrett.billingsley gmail.com> wrote:

 On Thu, May 7, 2009 at 1:38 PM, bearophile <bearophileHUGS lycos.com>  
 wrote:

 The following doesn't work, the pragma isn't seen as an instruction,  
 I guess this is normal, but I don't like it much:

 static if (true)
    pragma(msg, "true");
 else
    pragma(msg, "false");
Funny, I just ran into that today too. If you add braces, for some reason it works.
 D2 programs need more and more compile-time printing, and:
 pragma(msg, ToString(...) ~ ...);
 isn't much nice.
Once again: 'much' and 'too much' can never. modify. adjectives. They are not adverbs.
Much. can be. an adverb. http://www.merriam-webster.com/dictionary/much%5B2%5D Besides, who really cares if people use incorrect grammar? We aren't turning in essay papers here. Bearophile, what you meant to say was "isn't much nicer".
Or "isn't very nice". (At least, if looking at bearophile's regular use of that phrase. Could it be that "very" and "much" are the same word in Italian?) Not that I care, English isn't my first language, either. ;-)
could be, I didn't read the whole context. If you were comparing something to something else, then "isn't much nicer" makes sense, but if you are not comparing two things, then "isn't very nice" makes more sense. "isn't much nice" seems like it should make sense from a purely grammatical point of view, but it sounds weird to me :) I don't know why it's bad, but it is. -Steve
May 08 2009
parent Don <nospam nospam.com> writes:
Steven Schveighoffer wrote:
 On Fri, 08 May 2009 08:28:28 -0400, Georg Wrede <georg.wrede iki.fi> wrote:
 
 Steven Schveighoffer wrote:
 On Thu, 07 May 2009 16:02:52 -0400, Jarrett Billingsley 
 <jarrett.billingsley gmail.com> wrote:

 On Thu, May 7, 2009 at 1:38 PM, bearophile 
 <bearophileHUGS lycos.com> wrote:

 The following doesn't work, the pragma isn't seen as an 
 instruction, I guess this is normal, but I don't like it much:

 static if (true)
    pragma(msg, "true");
 else
    pragma(msg, "false");
Funny, I just ran into that today too. If you add braces, for some reason it works.
 D2 programs need more and more compile-time printing, and:
 pragma(msg, ToString(...) ~ ...);
 isn't much nice.
Once again: 'much' and 'too much' can never. modify. adjectives. They are not adverbs.
Much. can be. an adverb. http://www.merriam-webster.com/dictionary/much%5B2%5D Besides, who really cares if people use incorrect grammar? We aren't turning in essay papers here. Bearophile, what you meant to say was "isn't much nicer".
Or "isn't very nice". (At least, if looking at bearophile's regular use of that phrase. Could it be that "very" and "much" are the same word in Italian?) Not that I care, English isn't my first language, either. ;-)
could be, I didn't read the whole context. If you were comparing something to something else, then "isn't much nicer" makes sense, but if you are not comparing two things, then "isn't very nice" makes more sense. "isn't much nice" seems like it should make sense from a purely grammatical point of view, but it sounds weird to me :) I don't know why it's bad, but it is. -Steve
"nice" isn't measurable, so you can't use "much". Likewise, you can only use "many" if it's something you can count.
May 08 2009