chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] Pessimizing undefined behavior


From: felix . winkelmann
Subject: Re: [Chicken-hackers] Pessimizing undefined behavior
Date: Tue, 02 Apr 2019 16:50:20 +0200

> In my opinion, this is not a good direction for implementations of any
> language
> to go.  The Chicken community has been repeatedly bitten by the increasing
> tendency of C compilers to do whatever they want rather than whatever makes
> sense in the context of undefined behavior (the C equivalent of "is an
> error").
>
>[...]
>
> In Scheme, whoever writes (begin) in a value context, even as a result
> of macro expansion, is almost certainly making a mistake,
> and the Right Thing IMO is to report an error, not to pessimize the code.

I completely agree to most of what John writes, although I wouldn't signal
an error in the case given. Code using the result of (begin) is legal, even
if it is questionable. A user _may_ want to exploit implementation defined
behaviour and the implementation shouldn't forbid this, but the implementation
should not give semantics arbitrarily (for very little gain) to something that,
strictly speaking, has no semantics in the language. So let's just give a
warning at most and do not behave in a particular way and depend on an
arbitrary interpretation that happens to give a tiny opportunity for 
optimization..


felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]