[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Info-gnuprologjava] gnuprologjava patch: fixes for is_list
From: |
Michiel Hendriks |
Subject: |
Re: [Info-gnuprologjava] gnuprologjava patch: fixes for is_list |
Date: |
Tue, 8 May 2012 22:24:13 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Tue, May 08, 2012 at 07:31:00PM +0100, Paul Singleton wrote:
> On 07/05/2012 22:22, Michiel Hendriks wrote:
>
> >Small note to the patch, use TermConstants.emptyListAtom.equals(lst)
> >rather than the instance check.
>
> Is that just good practice, or is there some way we could get two
> distinct instances of the "empty list" atom? AtomTerm seems
> designed to ensure that never happens, but maybe we shouldn't rely
> on it...
It's mostly good practice. It makes the code more readable, but also
makes it future proof.
For example through reflection you would be able to create an instance
of AtomTerm that is equal to TermConstants.emptyListAtom, but is not the
same instance.
--
Michiel "elmuerte" Hendriks address@hidden
http://elmuerte.com