guile-devel
[Top][All Lists]
Advanced

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

Re: Special variables to relax boxing


From: Mark H Weaver
Subject: Re: Special variables to relax boxing
Date: Thu, 21 Mar 2013 02:00:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi Stefan,

Stefan Israelsson Tampe <address@hidden> writes:
> I wouldl like to start a discussion of introducing a way to mark
> variables as special, and by that mean that set! variables does not
> nessesary get boxed.

I don't think you fully understand the ramifications of what you're
proposing here.  In the general case, mutable variables need to be boxed
because closures end up with copies of any free variables that they
reference.  If a free variable is mutable, that means it needs a copy of
the _location_ where the value is stored.  Making a copy of the _value_
of a variable at the time of closure creation would lead to very
unintuitive (and IMO broken) behavior.

More importantly, you are describing this proposed language feature in
terms of low-level implementation details.  If you're serious about
proposing such a fundamental new feature to Scheme, please start by
reading and understanding the denotational semantics of the R5RS,
especially sections 3.1 and 3.4, and then reformulate your proposal in
those terms.  For such a fundamental change, I'd want to see a proposed
new formal denotational semantics to replace those in section 7.2.

To be honest, I'm not suggesting this to help you refine this proposal.
I'm suggesting it because I think it would help you to think more
clearly about these issues, and to appreciate the beautiful elegance of
Scheme's minimalist semantics.  Furthermore, I hope it would help you to
understand what a terrible mistake it would be to muck such a beautiful
language with hacks such as this.  Every added bit of complexity in the
core of a language has to be paid for a hundred times over, in both code
(compilers, optimizers, etc) and more importantly in the mental effort
required to reason about the language.

       Mark



reply via email to

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