r/Compilers • • 15d ago

optimistic or pessimistic compiler?

for those that compose and craft compilers, do you find the results better and more satisfying for you if the compiler you work on is permissive/optimistic or strict/pessimistic?

permissive/optimistic here means that the starting point is the compiler assumes the line of code that it is parsing/evaluating is probably ok but needs to pass some checks before translating to the target backend? (this is “the compiler is your friend” approach)

strict/pessimistic here means that the starting point is the compiler assumes the line of code that it is parsing/evaluating has something wrong and its job is to discover that wrong thing, and it is disappointed when the line passes all checks before translating to the target backend? (this is “the compiler is the teacher we’ve all had at one point in our life where they assume you’re going to do something bad as soon as they’re not looking” - and they’re not wrong)

obviously there has to be some balance here, but i’m curious, what has been your experience with these two approaches?

7 Upvotes

16 comments sorted by

View all comments

Show parent comment

0

u/FluxProgrammingLang 15d ago edited 15d ago

Those are obviously grammar and syntax errors, which are caught. Why do people insist on the “most vexing parse” when reading what someone said? It’s like me telling you the oven only goes to 450°F, and you say well mine does, my family’s oven does, my neighbors oven does, but we don’t use plastic cooking pans cause they’ll melt. No way, really? Effectively reducing what i said to its most incorrect interpretation.

Here’s an example, say I assign a u64 ptr address to a u32 ptr without casting the value. This is an error in a lot of languages. Not in mine because I have a reason to do that sometimes.

Note to OP: be prepared for people to do what matthieum does to things you say.