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
asd wrote:
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(""))
{
int x = 1;
}
}
test.d(5
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(""))
> >>{
> >>
asd wrote:
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(""))
{
i
Jarrett Billingsley wrote:
> On Fri, Jul 24, 2009 at 11:03 PM, asd wrote:
>> 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;
>
> It works if you use 'if' instead of
On Fri, Jul 24, 2009 at 11:03 PM, asd wrote:
> 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;
It works if you use 'if' instead of 'static if', oddly.
> return fa
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;
On Fri, Jul 24, 2009 at 8:27 PM, asd wrote:
> 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;
>
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