c3lang / c3c

Compiler for the C3 language
GNU Lesser General Public License v3.0
1.34k stars 80 forks source link

Is $checks available? #1166

Closed LukyGuyLucky closed 3 months ago

LukyGuyLucky commented 3 months ago

From the handbook: $checks() returns true if the expression inside is valid.

May I ask is $checks available in current build?

import std::io; fn void main(){ io::printn($checks('a'+1));//Error: '$checks' could not be found, did you spell it right? }

Regards, Peter

lerno commented 3 months ago

No, $checks is no longer available. It was too imprecise. For example you could write $checks('a' + b) and this could fail due either the addition not being valid or b wasn't in scope. After frequently making such mistakes and getting hard to debug problems because of it, I removed $checks and added capabilities to $defined instead.

LukyGuyLucky commented 3 months ago

Got it.Thanks.