Open timotheecour opened 5 years ago
That's what you get when the backend is allowed to report errors. You would have written it the same way because of "DRY".
@araq follow up from https://github.com/nim-lang/Nim/pull/9916#issuecomment-445839902 :
IMO system.compiles's spec should be "type supports operation" as well as "is importable module", nothing more
so compiles("[0,1][10]")
returning true
is intended behavior ? docs could be a bit clarified regarding that aspect (from user POV, it's not clear that it's a backend vs semantic error)
in any case, I agree with your point thatcompiles(s)
shouldn't call into backend ; and also should be kept as efficient as possible, since otherwise it could slow down compilation for some programming patterns (eg toSeq
)
compiles("[0,1][10]")
is an edge case that could return either. But in theory array indexing is a "supported operation" so true fits the bill.
why this is annoying