Akuli / jou

Yet another programming language
MIT License
11 stars 4 forks source link

int as bool #427

Closed Akuli closed 7 months ago

Akuli commented 7 months ago

I tried to do this:

        v = get_special_constant(expr->varname)
        if v != -1:
            return v as bool

where get_special_constant() always returns -1, 0, or 1. This doesn't work:

compiler error in file "self_hosted/evaluate.jou", line 23: cannot cast from type int to bool

IMO this should be possible. Sometimes foo as bool is more readable than foo != 0.

Akuli commented 7 months ago

It's been about 15 seconds since I posted the issue, and I no longer like this idea.