std.metastrings.ToString! problems

2009-07-23 Thread asd
I'm trying to write basic compile-time function: string usedForMixin() { int n=0; /* do stuff */ return "int x = " ~ std.metastrings.ToString!(n) ~ ";"; } However I'm getting: /usr/local/bin/../src/phobos/std/metastrings.d(104): Error: expression cast(long)n is not a valid template value arg

Re: std.metastrings.ToString! problems

2009-07-24 Thread asd
> >> n < 0L is not constant or does not evaluate to a bool > >> (D2, OS X) > >> > > That's because n isn't a compile-time constant. You can't instantiate > > a template with runtime variables. > > > > that includes "runtime variables" used in CTFE (this is because CTFE > functions > are also

Compile-time constness is waaay to strict!

2009-07-24 Thread asd
I've got D2 code: > template ObjcMethodSelectorCheck(string sel, A...) { > const n = countMethodArguments(sel); and: pure static uint countMethodArguments(string name) { if (name.length == 0) return 0; if (name[0] == ':') return 1+countMethodArg

Re: Compile-time constness is waaay to strict!

2009-07-24 Thread asd
Jarrett Billingsley Wrote: > Can you post more of your code? I've reduced it to this: bool isEmptyString(string str) { static if (str == "") return true; return false; } void main() { static if (isEmptyString("")) { int x = 1;

Re: Compile-time constness is waaay to strict!

2009-07-25 Thread asd
Daniel Keep Wrote: > >> bool isEmptyString(string str) { > >>static if (str == "") return true; > > > > It works if you use 'if' instead of 'static if', oddly. > > > >>return false; > >> } > >> > >> void main() > >> { > >>static if (isEmptyString("")) > >>{ > >>

Re: Compile-time constness is waaay to strict!

2009-07-25 Thread asd
KennyTM~ Wrote: > It makes sense. A compile-time function must be executable in run time > as well. Which means both of the following must be meaningful. > > void main () { >auto s = readln(); >if (isEmptyString(s)) { ... } // Run time executed > } > > void main2 () { >static if (is

Re: Apple Blocks added to C++?

2009-09-02 Thread asd
Jeremie Pelletier Wrote: > There's a huge difference between complex code and long code, especially in > compiled languages. Those 8 lines in your code are not convenient in that you > don't get what they do on first sight. Declaring your things separately and > then registering the closures to

Re: [OT] Modern-day Mac EOLs?

2009-09-29 Thread asd
Marianne Gagnon Wrote: > OS X uses \n. \r dates from OS 9 (see http://en.wikipedia.org/wiki/Newline) > > As simple as that ;) IMHO \r as line separator and MacRoman encoding should be killed with fire. I've had too much trouble with these OS9isms generated by some apps that tried to be nice.

Re: What does Coverity/clang static analysis actually do?

2009-10-17 Thread asd
Walter Bright Wrote: > >> 2. Optimizer collects the info, but ignores this, because people are > >> annoyed by false positives. clang analyzer tries to avoid false positives very hard. To the point that every error message has link for sending a bug report. > The problem crops up when there ar

Hello World crashes on OS X 10.6.1

2009-10-31 Thread asd
import std.stdio; void main() { writef("Hello world\n"); } dmd -run test.d gives: Process: test [1703] Path:/Users/username/Desktop/test Identifier: test Version: ??? (???) Code Type: X86 (Native) Parent Process: dmd [1698] Date/Time: 2009

Re: Hello World crashes on OS X 10.6.1

2009-10-31 Thread asd
forgot to add it's freshly downloaded dmd v2.035.

Re: D Language 2.0

2010-01-24 Thread asd
Andrei Alexandrescu Wrote: > > Why would having one chunk of code get checked for calls to the GC and > > another not be any more complicated than mixing > > malloc/free+add/removeRoot with normal GC? I'm beginning to wonder if > > I'm calling for something different than other people are. > >