[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Working with constansts
From: |
Richard Riley |
Subject: |
Re: Working with constansts |
Date: |
Mon, 11 May 2009 03:38:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
Barry Margolin <barmar@alum.mit.edu> writes:
> In article <mailman.6953.1241976532.31690.help-gnu-emacs@gnu.org>,
> Richard Riley <rileyrgdev@googlemail.com> wrote:
>
>> So really the question would be : why does Lisp not enforce constants
>> being, err, constant?
>
> Because this would incur overhead on every assignment, as it would have
> to check whether the variable being assigned was declared as a constant.
> Since this is so rarely the case, this overhead could be seen as mostly
> wasted and unnecessary.
I don't know enough about Lisp than I can only assume that in this case
it can not be detected at compile time IF you compile to byte/p code.
>
> On the other hand, it would be nice if the byte compiler would warn
> about this. Declaring a constant could put something in its property
> list, and the compiler could then warn if it sees assignments to the
> variable.
>
> Some Common Lisp implementations get around the overhead problem by
> putting constants in a page of VM marked read-only, so a hardware trap
> is raised if an attempt is made to assign it.
This makes sense. My initial enquiry was kind of "yeah, thats the way
you say it is, but should it really be like that". If you get my drift.
- Re: Working with constansts, (continued)
- Re: Working with constansts, Tassilo Horn, 2009/05/11
- Message not available
- Re: Working with constansts, Pascal J. Bourguignon, 2009/05/10
- Re: Working with constansts, Richard Riley, 2009/05/10
- Re: Working with constansts, Pascal J. Bourguignon, 2009/05/11
- Re: Working with constansts, Nikolaj Schumacher, 2009/05/12
- Message not available
- Re: Working with constansts, Pascal J. Bourguignon, 2009/05/12
- Re: Working with constansts, Nikolaj Schumacher, 2009/05/18
- Message not available
- Message not available
- Message not available
- Re: Working with constansts, Pascal J. Bourguignon, 2009/05/18
- Re: Working with constansts, Nikolaj Schumacher, 2009/05/18
- Message not available
- Re: Working with constansts, Barry Margolin, 2009/05/10
- Re: Working with constansts,
Richard Riley <=
- Re: Working with constansts, Nikolaj Schumacher, 2009/05/12
- Message not available
- Re: Working with constansts, Pascal J. Bourguignon, 2009/05/12
- Message not available
- Re: Working with constansts, Barry Margolin, 2009/05/13
- Re: Working with constansts, Ralf Wachinger, 2009/05/13
- Re: Working with constansts, Barry Margolin, 2009/05/13
- Re: Working with constansts, Thien-Thi Nguyen, 2009/05/11
- Message not available
- Re: Working with constansts, Barry Margolin, 2009/05/11
Re: Working with constansts, Decebal, 2009/05/11