Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Symbol pollution non-issue.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 76 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kaz Kylheku  
View profile  
 More options Feb 6, 4:05 pm
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@kylheku.com>
Date: Mon, 6 Feb 2012 21:05:53 +0000 (UTC)
Local: Mon, Feb 6 2012 4:05 pm
Subject: Symbol pollution non-issue.
You know I was just thinking about this whole non-issue that seems to irk some
people that if you misspell some symbol in your REPL, it gets interned and then
stays there forever until you manually scrub it away. I know that Clojure
obsesses over this also: it has a way by which such symbols are treated as
garbage.

What if packages simply used weak pointers for hanging on to symbols?  So, come
garbage collection time, if the only reference to a symbol is via its
registration in the package system, it disappears.

If you call (intern "FOO" some-package), ignore the return value, and then the
next time you call (intern "FOO" some-package), you may get a different object.
However, sucha  program has no way to tell that it got a different object; it
has no reference to the previously returned symbol to be able to make a
comparison, and if it does retain that reference, then doing so ensures that
the same symbol is returned.

It's a change in behavior for a program which interns a symbol, discards the
reference and then performs a FIND-SYMBOL to check whether the symbol is still
in the package. It may or may not be.

It seems as if DEFPACKAGE breaks because DEFPACKAGE is used to introduce a
bunch of symbols. The weakness could be set up on a per symbol basis. For
instance exported symbols could be normal references, protected from lapsing
under gc.

Shadowing definitions pose another problem. We sometimes make visible one
package inside another package, but then shadow some selectged symbols.
The shadowing symbols are often internal, and so not protected from lapsing by
the above rule. Solution: the symbols which are in the shadow symbol list of a
package are also protected from lapsing.

The principle is to separate "semantic garbage" symbols in a package,
from ones that are deliberate installed there by programmer intent.

Thoughts?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Feb 6, 5:49 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@alum.mit.edu>
Date: Mon, 06 Feb 2012 17:49:10 -0500
Local: Mon, Feb 6 2012 5:49 pm
Subject: Re: Symbol pollution non-issue.
In article <20120206213703....@kylheku.com>,
 Kaz Kylheku <k...@kylheku.com> wrote:

> What if packages simply used weak pointers for hanging on to symbols?  So,
> come
> garbage collection time, if the only reference to a symbol is via its
> registration in the package system, it disappears.

(defvar foo 3)
(gc)
(print foo)
;;; Error: Unbound symbol FOO

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kaz Kylheku  
View profile  
 More options Feb 6, 5:53 pm
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@kylheku.com>
Date: Mon, 6 Feb 2012 22:53:19 +0000 (UTC)
Local: Mon, Feb 6 2012 5:53 pm
Subject: Re: Symbol pollution non-issue.
On 2012-02-06, Barry Margolin <bar...@alum.mit.edu> wrote:

> In article <20120206213703....@kylheku.com>,
>  Kaz Kylheku <k...@kylheku.com> wrote:

>> What if packages simply used weak pointers for hanging on to symbols?  So,
>> come
>> garbage collection time, if the only reference to a symbol is via its
>> registration in the package system, it disappears.

> (defvar foo 3)
> (gc)
> (print foo)
> ;;; Error: Unbound symbol FOO

This wouldn't be a problem because the existence of a variable binding would
create a reference to the symbol FOO.

(I realize that some represenations of dynamic variables don't work that way,
but they would have to for this proposal. I.e. there has to be some association
which binds FOO to a location, making it boundp, and that association holds a
reference to FOO.)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kaz Kylheku  
View profile  
 More options Feb 6, 5:57 pm
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@kylheku.com>
Date: Mon, 6 Feb 2012 22:57:17 +0000 (UTC)
Local: Mon, Feb 6 2012 5:57 pm
Subject: Re: Symbol pollution non-issue.
On 2012-02-06, Kaz Kylheku <k...@kylheku.com> wrote:

So in other words:

 > (defvar foo 3)
 > (gc)
 > foo
 3
 > (makunbound 'foo)
 > (gc)
 > (find-symbol "FOO")
 NIL
 > foo
 ;; error: unbound symbol


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Feb 6, 5:57 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@alum.mit.edu>
Date: Mon, 06 Feb 2012 17:57:18 -0500
Local: Mon, Feb 6 2012 5:57 pm
Subject: Re: Symbol pollution non-issue.
In article <20120206235044...@kylheku.com>,
 Kaz Kylheku <k...@kylheku.com> wrote:

No it wouldn't.  A variable binding is a reference FROM the symbol, not
TO the symbol.

> (I realize that some represenations of dynamic variables don't work that way,
> but they would have to for this proposal. I.e. there has to be some
> association
> which binds FOO to a location, making it boundp, and that association holds a
> reference to FOO.)

If bindings were maintained in a symbol table, it would work that way.  
But the more common representation is just a pointer from the symbol's
value cell.

A dynamic LET binding of a special variable will usually contain a
reference to the symbol, but toplevel bindings usually don't.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Feb 6, 6:11 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@alum.mit.edu>
Date: Mon, 06 Feb 2012 18:11:23 -0500
Local: Mon, Feb 6 2012 6:11 pm
Subject: Re: Symbol pollution non-issue.
In article <20120206235303....@kylheku.com>,
 Kaz Kylheku <k...@kylheku.com> wrote:

MACLISP had a feature called "GCTWA": Garbage Collect Truly Worthless
Atoms.  Symbols with no value or function bindings, and which were not
referenced in any data structures other than the obarray, would be
garbage collected.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kaz Kylheku  
View profile  
 More options Feb 6, 6:25 pm
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@kylheku.com>
Date: Mon, 6 Feb 2012 23:25:01 +0000 (UTC)
Local: Mon, Feb 6 2012 6:25 pm
Subject: Re: Symbol pollution non-issue.
On 2012-02-06, Barry Margolin <bar...@alum.mit.edu> wrote:

In the abstract, a binding is some kind of association between a symbol and a
storage place. This association is semantically important, regardless of how
the arrows go and must prevent the symbol from being semantic garbage.

(For instance in simple textbook Lisp interpreters a common strategy is to use
an assoc list to represent an environment.  A binding is found using (assoc sym
env).  That representation of environments "naturally" protects symbols, but
the list has to be traversed to find variables.

>> (I realize that some represenations of dynamic variables don't work that way,
>> but they would have to for this proposal. I.e. there has to be some
>> association
>> which binds FOO to a location, making it boundp, and that association holds a
>> reference to FOO.)

> If bindings were maintained in a symbol table, it would work that way.  
> But the more common representation is just a pointer from the symbol's
> value cell.

Perfectly fine; this falls into the same logic as exported symbols being
protected. Basically various attributes somehow protect a symbol:
- presence in the shadowing symbols list
- presence in the list of exported symbols
- function or variable binding
- anything else: definition of the symbol as a class, type, etc.

Clearly, disappearing variables are a complete nonstarter, everyone must agree.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Feb 6, 6:59 pm
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Tue, 07 Feb 2012 00:59:10 +0100
Local: Mon, Feb 6 2012 6:59 pm
Subject: Re: Symbol pollution non-issue.

Barry Margolin <bar...@alum.mit.edu> writes:
>> >>  Kaz Kylheku <k...@kylheku.com> wrote:

>> >>> What if packages simply used weak pointers for hanging on to symbols?  
>> >>> So,
>> >>> come
>> >>> garbage collection time, if the only reference to a symbol is via its
>> >>> registration in the package system, it disappears.

> MACLISP had a feature called "GCTWA": Garbage Collect Truly Worthless
> Atoms.  Symbols with no value or function bindings, and which were not
> referenced in any data structures other than the obarray, would be
> garbage collected.

Indeed. In the case of Common Lisp symbols, they have a value slot, a
function slot and a property list.

If the value slot is bound (even to NIL), or the function slot is bound,
or the property list is not NIL (it cannot be "unbound"), then one could
consider that symbol useless.

However, in Common Lisp, FIND-SYMBOL let you retrieve at least one bit
of information, and collecting "useless" symbols destroy that
information.

    'seen-pjb
    (find-symbol "SEEN-PJB") ; --> SEEN-PJB
    (gc)
    (find-symbol "SEEN-PJB") ; -- NIL

would be bad.

On the other hand, if we considered that all the symbols already exist,
this would break the package system, where importing symbols from other
packages or "using" other packages creates collision errors.  One would
have to unintern (would that be effective), or "shadow" all the imported
or used symbols before.

But as the title says, it's a non-issue.   You just reboot a lisp image
and load a compiled library and those symbols don't exist anymore.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Feb 6, 7:29 pm
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Mon, 06 Feb 2012 16:29:37 -0800
Local: Mon, Feb 6 2012 7:29 pm
Subject: Re: Symbol pollution non-issue.
In article <20120206213703....@kylheku.com>,
 Kaz Kylheku <k...@kylheku.com> wrote:

> You know I was just thinking about this whole non-issue

It's not a non-issue.  The mere fact that this discussion is happening
means that, by definition, it is an issue.  See:

http://www.merriam-webster.com/dictionary/issue

"is·sue noun - a matter that is in dispute between two or more parties"

> that seems to irk some
> people that if you misspell some symbol in your REPL, it gets interned and
> then stays there forever until you manually scrub it away.

The problem is not that it stays forever, the problem is that it can
cause extraneous naming conflicts even if it doesn't stay forever.  The
most common screw case is this one:

? (make-package :lib)
#<Package "LIB">
? (make-package :app)
#<Package "APP">
? (in-package :lib)
#<Package "LIB">
? (defun libfn () t)
LIBFN
? (in-package :app)
#<Package "APP">
? (defun foo () (libfn))
;Compiler warnings :
;   In FOO: Undefined function LIBFN
FOO
? (import 'lib::libfn)
- Error: Importing LIB::LIBFN to #<Package "APP"> would conflict
- with symbol LIBFN .

But that is far from the only screw case.

Note that the mere act of parsing the code (not the subsequent
unsuccessful attempt to compile it) is what left the system in a state
where it is no longer possible to use the library without manual
corrective action.

rg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Feb 6, 10:06 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@alum.mit.edu>
Date: Mon, 06 Feb 2012 22:06:28 -0500
Local: Mon, Feb 6 2012 10:06 pm
Subject: Re: Symbol pollution non-issue.
In article <87wr7zv7ht....@kuiper.lan.informatimago.com>,
 "Pascal J. Bourguignon" <p...@informatimago.com> wrote:

> However, in Common Lisp, FIND-SYMBOL let you retrieve at least one bit
> of information, and collecting "useless" symbols destroy that
> information.

>     'seen-pjb
>     (find-symbol "SEEN-PJB") ; --> SEEN-PJB
>     (gc)
>     (find-symbol "SEEN-PJB") ; -- NIL

> would be bad.

Why? If you're not actually using the symbol for anything, what could it
break?  After all, if you store the result of find-symbol anywhere, that
will prevent it from being GC'ed.  If you don't, how would you know that
it ever existed and then disappeared?  The user's memory doesn't count;
lots of things get seen by the user, but later get GC'ed.

The only thing I can imagine that would be affected by this would be a
program that uses a package as a replacement for a hash table mapping
strings to booleans.  Screw them, they should use an actual hash table.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Feb 6, 11:32 pm
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Tue, 07 Feb 2012 05:32:28 +0100
Local: Mon, Feb 6 2012 11:32 pm
Subject: Re: Symbol pollution non-issue.

I just explained what it could break!  
Programs such as:

(defun encode (message)
  (loop
     :for ch :across message
     :for i :from 0
     :do (intern (format nil "MSG[~D]=~C" i ch))))

(defun decode ()
  (let ((buf (make-array 80 :element-type 'character
                         :adjustable t
                         :fill-pointer 0
                         :initial-element #\?)))
    (do-symbols (s)
      (let ((ss (string s)))
        (when (and (< 4 (length ss)) (string= ss "MSG[" :end1 4))
          (multiple-value-bind (i p) (parse-integer ss :start 4
                                                    :junk-allowed t)
            (when (<= (length buf) i)
              (setf buf (adjust-array buf (1+ i)
                                      :element-type (array-element-type buf)
                                      :fill-pointer (fill-pointer buf)
                                      :initial-element #\?)))
            (when (<= (fill-pointer buf) i)
              (setf (fill-pointer buf) (1+ i)))
            (setf (aref buf i) (aref ss (+ p 2)))))))
    buf))

CL-USER> (encode "Hello World!")
NIL
CL-USER> (decode)
"Hello World!"

> Screw them, they should use an actual hash table.

What about obfuscation?

But it is a non-issue, because changing this, would change the language,
and have possibly wide ramifications.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Feb 7, 1:12 am
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Mon, 06 Feb 2012 22:12:14 -0800
Local: Tues, Feb 7 2012 1:12 am
Subject: Re: Symbol pollution non-issue.
In article <87obtbuuub....@kuiper.lan.informatimago.com>,
 "Pascal J. Bourguignon" <p...@informatimago.com> wrote:

You do realize that if you advanced this as a serious example anywhere
but c.l.l. you would be a laughingstock, right?

> But it is a non-issue, because changing this, would change the language,
> and have possibly wide ramifications.

Nope, can't have any of that evil changey stuff around here, no sir.

rg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Antony  
View profile  
 More options Feb 7, 2:45 am
Newsgroups: comp.lang.lisp
From: Antony <remove+spam_lisp.li...@gmail.com>
Date: Mon, 06 Feb 2012 23:45:34 -0800
Local: Tues, Feb 7 2012 2:45 am
Subject: Re: Symbol pollution non-issue.
On 2/6/2012 2:57 PM, Kaz Kylheku wrote:

I use
(defvar foo )
and leave it intentionally unbound for stuff that I expect to bind in
the context of a thread (as in http processing). This allows me catch
some issues.
We can not throw away such a symbol.

But I think defvar introduced symbols are not a good example of what you
are suggesting to fix anyway. This is because defvar also marks
something as 'special', whether bound or not.
That makes it more (?) than just a symbol.

That brings a question to my mind - how would someone check if something
is special var.

-Antony


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kaz Kylheku  
View profile  
 More options Feb 7, 3:02 am
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@kylheku.com>
Date: Tue, 7 Feb 2012 08:02:15 +0000 (UTC)
Local: Tues, Feb 7 2012 3:02 am
Subject: Re: Symbol pollution non-issue.
On 2012-02-07, RG <rNOSPA...@flownet.com> wrote:

> In article <87obtbuuub....@kuiper.lan.informatimago.com>,
>  "Pascal J. Bourguignon" <p...@informatimago.com> wrote:
>> I just explained what it could break!  
>> Programs such as:

> You do realize that if you advanced this as a serious example anywhere
> but c.l.l. you would be a laughingstock, right?

Only because of all the parentheses.

Here it is also a laughingstock because of what it's doing.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kaz Kylheku  
View profile  
 More options Feb 7, 3:05 am
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@kylheku.com>
Date: Tue, 7 Feb 2012 08:05:13 +0000 (UTC)
Local: Tues, Feb 7 2012 3:05 am
Subject: Re: Symbol pollution non-issue.
On 2012-02-07, Antony <remove+spam_lisp.li...@gmail.com> wrote:

Correct. So the throwing away or not cannot be naively predicated on having a
value or not. But if you defvar something, that symbol has to be remembered
somewhere so that it can be pervasively special, and that can protect it.

> That brings a question to my mind - how would someone check if something
> is special var.

(special-variable-p 'sym)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tamas Papp  
View profile  
 More options Feb 7, 6:59 am
Newsgroups: comp.lang.lisp
From: Tamas Papp <tkp...@gmail.com>
Date: Tue, 7 Feb 2012 11:59:54 +0000 (UTC)
Local: Tues, Feb 7 2012 6:59 am
Subject: Re: Symbol pollution non-issue.

I don't see the need for manual correction as a nuisance, especially
in this case.  Any decent environment should offer the obvious
restarts, and resolving the conflict just takes a few keystrokes in
SLIME (BTW, SBCL also gives a style-warning about the DEFUN FOO using
the undefined function LIBFM).

I prefer deciding these issues manually when they occur instead of
some dwim-style cleverness that would save a few keystrokes in 99% of
the cases, then, in the remaining 1%, fail silently and cause trouble
later.

Best,

Tamas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options Feb 7, 7:55 am
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@tfeb.org>
Date: Tue, 7 Feb 2012 12:55:34 +0000 (UTC)
Local: Tues, Feb 7 2012 7:55 am
Subject: Re: Symbol pollution non-issue.

RG <rNOSPA...@flownet.com> wrote:
> It's not a non-issue.  The mere fact that this discussion is happening
> means that, by definition, it is an issue.  See:

It's an issue in the sense that people worry about it.  Would it be an
issue if they just stopped worrying?  I don't know the answer to that, but
I suspect not.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Antony  
View profile  
 More options Feb 7, 8:42 am
Newsgroups: comp.lang.lisp
From: Antony <remove+spam_lisp.li...@gmail.com>
Date: Tue, 07 Feb 2012 05:42:00 -0800
Subject: Re: Symbol pollution non-issue.
On 2/7/2012 12:05 AM, Kaz Kylheku wrote:
> On 2012-02-07, Antony<remove+spam_lisp.li...@gmail.com>  wrote:
>> That brings a question to my mind - how would someone check if something
>> is special var.

> (special-variable-p 'sym)

Didn't find it in CLHS
Says undefined function in ccl (also sbcl)
Then I tried in clisp, it works

Interesting.

-Antony


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Feb 7, 9:26 am
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Tue, 07 Feb 2012 06:26:31 -0800
Local: Tues, Feb 7 2012 9:26 am
Subject: Re: Symbol pollution non-issue.
In article
<208471263350311915.117387tfb-tfeb....@reader443.eternal-september.org>,
 Tim Bradshaw <t...@tfeb.org> wrote:

> RG <rNOSPA...@flownet.com> wrote:

> > It's not a non-issue.  The mere fact that this discussion is happening
> > means that, by definition, it is an issue.  See:

> It's an issue in the sense that people worry about it.  Would it be an
> issue if they just stopped worrying?  I don't know the answer to that, but
> I suspect not.

http://en.wikipedia.org/wiki/Dr._Strangelove

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Feb 7, 10:10 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Tue, 07 Feb 2012 16:10:40 +0100
Local: Tues, Feb 7 2012 10:10 am
Subject: Re: Symbol pollution non-issue.

This is a conforming program.

>> But it is a non-issue, because changing this, would change the language,
>> and have possibly wide ramifications.

> Nope, can't have any of that evil changey stuff around here, no sir.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Feb 7, 10:11 am
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Tue, 07 Feb 2012 07:11:33 -0800
Local: Tues, Feb 7 2012 10:11 am
Subject: Re: Symbol pollution non-issue.
In article <jgr3nq$nc...@dont-email.me>, Tamas Papp <tkp...@gmail.com>
wrote:

For that toy example it's not so bad.  Consider this case:

(defun foo () (f1) (f2) (f3) ... (fn))

where each of the f's are defined in different package.

Or, worse:

(defun foo (x y z) ...)

(use-package :snoz)  ; which happens to export symbols named X, Y and Z

Now you have to manually resolve a conflict that may or may not actually
be a conflict (but almost certainly isn't).

> (BTW, SBCL also gives a style-warning about the DEFUN FOO using
> the undefined function LIBFM).

Yes, but by the time you get those warnings the damage has already been
done.

> I prefer deciding these issues manually when they occur instead of
> some dwim-style cleverness that would save a few keystrokes in 99% of
> the cases, then, in the remaining 1%, fail silently and cause trouble
> later.

But packages *are* "dwim-style cleverness" it's just that you have to
decide the w-i-m part before your code is parsed.  When you type "foo"
what you really mean is (intern "foo" *package*) because:

(defun foo (x y z) (f (g x) (h y z)))

looks a lot nicer than:

(cl:defun com.foo.joe::foo (com.foo.joe::x com.foo.joe::y com.foo.joe::z)
  (com.baz.lib::f (com.baz.lib::g com.foo.joe::x) (com.foo.lib::h
com.foo.joe::y com.foo.joe::z)))

I've actually seen people write CL code that looks like the second
example, BTW.

rg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Feb 7, 10:17 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Tue, 07 Feb 2012 16:17:20 +0100
Local: Tues, Feb 7 2012 10:17 am
Subject: Re: Symbol pollution non-issue.

Antony <remove+spam_lisp.li...@gmail.com> writes:
> On 2/7/2012 12:05 AM, Kaz Kylheku wrote:
>> On 2012-02-07, Antony<remove+spam_lisp.li...@gmail.com>  wrote:
>>> That brings a question to my mind - how would someone check if something
>>> is special var.

>> (special-variable-p 'sym)
> Didn't find it in CLHS
> Says undefined function in ccl (also sbcl)
> Then I tried in clisp, it works

> Interesting.

(defun special-variable-p (sym)
   (eval `(let ((,sym 42)) (declare (ignorable ,sym)) (boundp ',sym))))

(defvar *special*)
(let ((lexical 42))
  (declare (ignorable lexical))
  (list (special-variable-p '*special*)
        (special-variable-p 'lexical)
        (special-variable-p 'unknown)))
--> (T NIL NIL)

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Feb 7, 11:42 am
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@alum.mit.edu>
Date: Tue, 07 Feb 2012 11:42:38 -0500
Local: Tues, Feb 7 2012 11:42 am
Subject: Re: Symbol pollution non-issue.
In article <20120207090102....@kylheku.com>,
 Kaz Kylheku <k...@kylheku.com> wrote:

Also, if you have functions that bind it, the references from those
functions should protect it.  Although that's not totally safe -- what
if a GC happens between the DEFVAR and DEFUN.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Feb 7, 11:44 am
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@alum.mit.edu>
Date: Tue, 07 Feb 2012 11:44:06 -0500
Local: Tues, Feb 7 2012 11:44 am
Subject: Re: Symbol pollution non-issue.
In article
<208471263350311915.117387tfb-tfeb....@reader443.eternal-september.org>,
 Tim Bradshaw <t...@tfeb.org> wrote:

> RG <rNOSPA...@flownet.com> wrote:

> > It's not a non-issue.  The mere fact that this discussion is happening
> > means that, by definition, it is an issue.  See:

> It's an issue in the sense that people worry about it.  Would it be an
> issue if they just stopped worrying?  I don't know the answer to that, but
> I suspect not.

I looked up "nonissue" in the dictionary.  It says "a topic of little or
no importance".  It's not simply the opposite of an issue, it's a
statement about how significant it is.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kaz Kylheku  
View profile  
 More options Feb 7, 12:03 pm
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@kylheku.com>
Date: Tue, 7 Feb 2012 17:03:08 +0000 (UTC)
Local: Tues, Feb 7 2012 12:03 pm
Subject: Re: Symbol pollution non-issue.
On 2012-02-07, Antony <remove+spam_lisp.li...@gmail.com> wrote:

> On 2/7/2012 12:05 AM, Kaz Kylheku wrote:
>> On 2012-02-07, Antony<remove+spam_lisp.li...@gmail.com>  wrote:
>>> That brings a question to my mind - how would someone check if something
>>> is special var.

>> (special-variable-p 'sym)
> Didn't find it in CLHS
> Says undefined function in ccl (also sbcl)
> Then I tried in clisp, it works

Damn, did I teach you a CLISP-ism? Sorry.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 76   Newer >
« Back to Discussions « Newer topic     Older topic »