I'm not too clear on how the CL package system works, and probably how symbol->value resolution works in general.
% cat foo.lisp (defpackage foo (:export x)) (in-package :foo) ; cmucl likes a keyword here for some reason (setf x 10) % clisp [1]> (load "foo.lisp") ;; Loading file foo.lisp ... ;; Loading of file foo.lisp is finished. T [2]> (use-package :foo) ... error: X is already interned in COMMON-LISP-USER
Of course, (import 'foo:x) gives the same error, which also happens on cmucl. (find-symbol "X") claims that it is internal to USER, but X is neither bound nor fbound in USER (foo:x works as I expect). I suppose (based on my vague understanding of how symbols work), there's no need for a symbol to have a value, function, plist, or whatever to be interned, it merely needs to be mentioned. This sort of thing seems like it would easily create spurious name clashes (when you import a symbol you previously mentioned in a QUOTE), so maybe that's not how it works. Anyway, it still doesn't explain where the USER package is getting those symbols.
In addition, import and use-package seem work as I expect when COMMON-LISP-USER is not involved.
> I'm not too clear on how the CL package system works, and probably how > symbol->value resolution works in general.
> % cat foo.lisp > (defpackage foo > (:export x)) > (in-package :foo) ; cmucl likes a keyword here for some reason > (setf x 10) > % clisp > [1]> (load "foo.lisp") > ;; Loading file foo.lisp ... > ;; Loading of file foo.lisp is finished. > T > [2]> (use-package :foo) > ... error: X is already interned in COMMON-LISP-USER
Try: (defvar x 10) in foo.lisp. I don't know that that is the problem but it seems likely. Because you are setf'ing a previously unmentioned variable, x, the consequences are undefined.
qu...@hurl.ugcs.caltech.edu (Quinn Dunkan) writes: > I'm not too clear on how the CL package system works, and probably how > symbol->value resolution works in general.
> % cat foo.lisp > (defpackage foo > (:export x))
The :EXPORT clause takes an argument which is a string. It can't take the symbol to export since the symbol to export doesn't exist yet at the time the DEFPACKAGE form is read. But by specifying a symbol, you have created that symbol. You might as well have typed
(cl:defpackage cl-user::foo (:export cl-user::x))
This will be interpreted as
(CL:DEFPACKAGE "FOO" (:export "X"))
but as a side-effect, you have created CL-USER::FOO and CL-USER::X.
> (in-package :foo) ; cmucl likes a keyword here for some reason
Package names are strings, not symbols.
The defpackage defines a package named "FOO".
IN-PACKAGE does not evaluate its argument. It used to. Some implementations get worried if you say (in-package foo) that you are trying to name a variable; using a self-evaluating expression like "FOO" or :FOO or :foo works best.
> (setf x 10) > % clisp > [1]> (load "foo.lisp") > ;; Loading file foo.lisp ... > ;; Loading of file foo.lisp is finished. > T > [2]> (use-package :foo) > ... error: X is already interned in COMMON-LISP-USER
It's a bad idea to just use free uses of USE-PACKAGE.
In doing this USE-PACKAGE, you are trying to make CL-USER inherit FOO:X but there is already a CL-USER::X (see above). That conflict has to be dealt with.
Solution?
Use
(defpackage "FOO" (:export "X"))
Don't be making symbols you don't mean to use.
> Of course, (import 'foo:x) gives the same error, which also happens > on cmucl. (find-symbol "X") claims that it is internal to USER, but > X is neither bound nor fbound in USER (foo:x works as I expect). I > suppose (based on my vague understanding of how symbols work), > there's no need for a symbol to have a value, function, plist, or > whatever to be interned, it merely needs to be mentioned. This sort > of thing seems like it would easily create spurious name clashes > (when you import a symbol you previously mentioned in a QUOTE), so > maybe that's not how it works. Anyway, it still doesn't explain > where the USER package is getting those symbols.
You're making them!
> In addition, import and use-package seem work as I expect when > COMMON-LISP-USER is not involved.
Right. Because you're probably using them in packages that you haven't polluted. ;)
> > The :EXPORT clause takes an argument which is a string.
> Actually, a sequence of string designators.
> > Use
> > (defpackage "FOO" > > (:export "X"))
> > Don't be making symbols you don't mean to use.
> But this does the wrong thing if your lisp doesn't > by default read symbols as being in upper case.
I don't understand what you mean. All Common Lisp symbols are canonically in uppercase. If you want to make them be in lowercase, you want "foo" and "x". But I don't see why you would want to leave it to chance.
I have a suspicion you're actually confused on this, but I can't tell for sure by the way you're expressing yourself. The example below suggests a confusion.
> I prefer something like this:
> (defpackage :foo > (:export #:x))
> There was a long, drawn out thread about this last > year, wasn't there?
There may have been.
You're welcome to suggest whatever weird style you want. I just abhor this particular style.
Making extra gensyms to throw away seems silly.
Making extra symbols in the keyword package seems equally confusing and pointless to me.
As far as I know, this style was developed by people who want to stick their head in the standa nd not acknowledge that the normal internal case is, in fact, uppercase. I don't think the issue is that it might not be uppercase--it's that they _wish_ it might not be.
>The :EXPORT clause takes an argument which is a string. It can't take >the symbol to export since the symbol to export doesn't exist yet at the >time the DEFPACKAGE form is read. But by specifying a symbol, you have >created that symbol. You might as well have typed
Ah! I hadn't made the connection that you aren't in the package until you say in-package. Which is obvious in retrospect, I guess.
>> (in-package :foo) ; cmucl likes a keyword here for some reason
>Package names are strings, not symbols.
Ok, that makes sense now. Come to think of it, CLHS says a package designator is a string or a package---symbols are not included.
Which also makes me wonder why symbols work at all. CLOCC code uses:
(in-package :cllib)
Even given that a symbol is accepted as a package designator, I still don't understand why a keyword would also designate the same package, since :X and X are different symbols.
>It's a bad idea to just use free uses of USE-PACKAGE.
Do you mean that as in "you should use (:uses ...) in defpackage instead" or "you shouldn't clog up your namespace with lots of symbol inheriting"? In this case, I'm testing my packages from the REPL, so I can't put (:uses ...) in USER's defpackage, and I'm not too concerned with namespace pollution since it's temporary, and I can unuse if I make a mess. At least that's the idea.
Is there any reason to prefer:
(defpackage "FOO" (:export "A" "B" "C"))
over:
(defpackage "FOO") (in-package :foo) ; or "FOO"? (export '(a b c))
Kent M Pitman wrote: > > But this does the wrong thing if your lisp doesn't > > by default read symbols as being in upper case.
> I don't understand what you mean. All Common Lisp symbols are > canonically in uppercase. If you want to make them be in lowercase, > you want "foo" and "x". But I don't see why you would want to leave > it to chance.
> I have a suspicion you're actually confused on this, but I can't tell > for sure by the way you're expressing yourself. The example below > suggests a confusion.
The default readtable has readtable-case of :upcase, but you might want to change that -- or have it changed out from under you in the future by some vendor -- and the code I described would work regardless.
> As far as I know, this style was developed by people who want to stick > their head in the [sand and] not acknowledge that the normal internal > case is, in fact, uppercase.
Yes, I remember which side of that long thread you were on. :)
As a user, I do something protective like that just so I'm not potentially screwed if for some reason it does change. This doesn't indicate I want it to change, but if some vendor has made noises that suggest it may want to do that I am going to be careful. The cost is minimal.
* "Paul F. Dietz" <di...@interaccess.com> | But this does the wrong thing if your lisp doesn't by default read | symbols as being in upper case.
Then you are not using ANSI Common Lisp, but some other Lisp.
| I prefer something like this: | | (defpackage :foo | (:export #:x)) | | There was a long, drawn out thread about this last year, wasn't there?
I have tried long and hard to understand the position that (1) ANSI Common Lisp mandates upper-case symbol names, (2) someone does not like that, so (3) violating ANSI Common Lisp requirements is the only solution. It most definitely is not the _only_ solution.
If you are a good citizen of the Common Lisp community, you realize that it does not matter at all what the internal case of the symbols are. If you want to see and type lower-case symbol names, that has no bearing on what the internal symbol names must be. Thinking it does indicates a massive failure to grasp how the whole string-to-symbol operation works.
I am probably no more than a few days away from a fully working solution that would make Allegro CL, which has introduced this problem to our community, work equally well with _both_ upper-case and lower-case symbol names in the code it reads and its programmers are exposed to. Today, you are required to make a decision whether you want your code to see upper-case _or_ lower-case symbol names. This has been a source of some very serious annoyances and even "wars" here, but it has at its root a personal dislike of the arbitrary choice of upper-case symbol names and a lack of professionalism by those who hold this personal grudge against the standard. I believe I have found an easy, modular, and predictable way to make the programmer choose, so the implementor does not have to.
/// -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief.
* "Paul F. Dietz" <di...@interaccess.com> | The default readtable has readtable-case of :upcase, but you might want | to change that -- or have it changed out from under you in the future by | some vendor -- and the code I described would work regardless.
Paul, you have solved the wrong problem and have just created another, much more serious one: fear of trusting the standard. This is a very contagious fear and once started, can cause you to become paranoid in the extreme about trusting a language standard. Bugs in implementations are no longer bugs, they _may_ be intentional violations that you have to take into account in much more serious ways than bugs -- they are likely to last. Some vendors want you to live in this fear all the time, but the primary such fear-monger is fortunately not interested in Common Lisp. In my view, it is not a good sign at all when a vendor works against the community standards, and almost even worse when they give you a choice of departing from the standard with them or not, especially when you sort of have to depart with them to get their new features. I am not at all impressed with these tactics and their effect on people, which is why I have spent a huge amount of time trying to find alternative solutions that do not cause people to live in fear and engage in counter- measures to prevent painful brushes with vendor-initiated violations.
| Yes, I remember which side of that long thread you were on. :)
The "side" Kent and I are on is: as a vendor, DO NOT VIOLATE THE STANDARD just because you have a personal opinion or grudge against the committee decision to use upper-case symbol names. It is essentially arbitrary, and if you need a different solutions, make it coexist with the standard.
| As a user, I do something protective like that just so I'm not | potentially screwed if for some reason it does change.
You mean, if your vendor is not particularly interested in letting you continue to work with ANSI Common Lisp?
| This doesn't indicate I want it to change, but if some vendor has made | noises that suggest it may want to do that I am going to be careful. The | cost is minimal.
The cost should be zero. If your vendor makes fully conforming code stop working, they have transferred the cost of their decision to you. If they do this to you, you have to weigh that cost against the cost of using a different vendor.
I believe I have found a way to make the cost exactly zero to programmers. It does require some investment by the vendors, however, but this is how responsible people generally do language development. What has taken me so long is figuring out how to make this investment small enough and the obvious benefits large enough that people will want to make make it.
My _personal_ opinion is _also_ that lower-case symbol names look far more "modern" than upper-case symbol names, but I actually value my own professionalism towards specifications much higher than my personal opinion, so I have to accept that the symbol-names are upper-case until I can convince people that the specification should be changed, and when it is changed, that no previously conforming program would break. To make this even more palatable to users of other implementations than those I have the ability to influence, a solution has to be made available that all users can load into their Common Lisp systems and expect to work. I care enough about this issue to have spent a few months on this rather than just go ahead and violate the standard by flipping the case of all the characters of all the symbol names in the Common Lisp image and ask the rest of the world to deal with it.
/// -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief.
Erik Naggum <e...@naggum.net> writes: > * "Paul F. Dietz" <di...@interaccess.com> > | But this does the wrong thing if your lisp doesn't by default read > | symbols as being in upper case.
> Then you are not using ANSI Common Lisp, but some other Lisp.
This goes back to the question Erann Gat was implicitly raising of how easy it is to make another whole language. The answer? This easy.
Fortunately, Franz seems so far to like the plan I proposed for how to resolve this in a CL-compatible way in their products, and there is some hope that in the future this will be resolved. (Unless as they try to implement my suggestion they run into a snag that none of us has seen yet.)
Things don't get fixed overnight, but it's nice that they're interested in resolving this nagging and vexxing problem.
* Kent M Pitman | Fortunately, Franz seems so far to like the plan I proposed for how to | resolve this in a CL-compatible way in their products, and there is some | hope that in the future this will be resolved. (Unless as they try to | implement my suggestion they run into a snag that none of us has seen | yet.)
There are serious snags in this area. I believe I have worked them out.
/// -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief.
> > > The :EXPORT clause takes an argument which is a string.
> > Actually, a sequence of string designators.
> > > Use
> > > (defpackage "FOO" > > > (:export "X"))
> > > Don't be making symbols you don't mean to use.
> > But this does the wrong thing if your lisp doesn't > > by default read symbols as being in upper case.
> I don't understand what you mean. All Common Lisp symbols are > canonically in uppercase. If you want to make them be in lowercase, > you want "foo" and "x". But I don't see why you would want to leave > it to chance.
Careful about your use of the word "All". Remember, Common Lisp is not a case-insensitive language; only its reader is, and even that can be inhibited:
> I have a suspicion you're actually confused on this, but I can't tell > for sure by the way you're expressing yourself. The example below > suggests a confusion.
> > I prefer something like this:
> > (defpackage :foo > > (:export #:x))
> > There was a long, drawn out thread about this last > > year, wasn't there?
> There may have been.
> You're welcome to suggest whatever weird style you want. > I just abhor this particular style.
I assume that your reasoning below says why you abhor this style. However, I am going to ask the question anyway: Why? In fact, it would seem to me that if you are not the type of person who would type this way:
(DEFUN FOO (X) (BAR X))
but instead type your program in this way:
(defun foo (x) (bar x))
that you might then use the same reasoning to type your defpackage form in lowercase and have it come out right:
(:export #:x)
instead of
(:export #:X)
or
(:export "X")
> Making extra gensyms to throw away seems silly.
No more silly than making strings to throw away. A good defpackage implementation will optimize this out anyway.
> Making extra symbols in the keyword package seems equally confusing > and pointless to me.
Agreed. Both of these forms:
(:export x)
and
(:export :x)
are wasteful.
> As far as I know, this style was developed by people who want to stick > their head in the standa nd not acknowledge that the normal internal > case is, in fact, uppercase. I don't think the issue is that it might > not be uppercase--it's that they _wish_ it might not be.
Again, the internal representation of Common Lisp is not uppercase. It is only the reader that performs the case folding, and that can be turned off by quoting the characters.
> I think that only encourages confusion.
Perhaps, but I think the confusion is where the case sensitivity/insensitivity really occurs in Common Lisp.
-- Duane Rettig Franz Inc. http://www.franz.com/ (www) 1995 University Ave Suite 275 Berkeley, CA 94704 Phone: (510) 548-3600; FAX: (510) 548-8253 du...@Franz.COM (internet)
Erik Naggum <e...@naggum.net> writes: > * Kent M Pitman > | Fortunately, Franz seems so far to like the plan I proposed for how to > | resolve this in a CL-compatible way in their products, and there is some > | hope that in the future this will be resolved. (Unless as they try to > | implement my suggestion they run into a snag that none of us has seen > | yet.)
> There are serious snags in this area. I believe I have worked them out.
I'd be interested in seeing your solution. I have not had a chance to work on this (and have told Kent as much) because I am deep into buttoning up our 6.2 version, which has been essentially feature-frozen after beta release. But I am of course interested in seeing a solution for the future (it would also be nice if it were patchable).
-- Duane Rettig Franz Inc. http://www.franz.com/ (www) 1995 University Ave Suite 275 Berkeley, CA 94704 Phone: (510) 548-3600; FAX: (510) 548-8253 du...@Franz.COM (internet)
qu...@schilling.ugcs.caltech.edu (Quinn Dunkan) writes: > On Sat, 20 Apr 2002 01:01:27 GMT, Kent M Pitman <pit...@world.std.com> wrote: > > qu...@hurl.ugcs.caltech.edu (Quinn Dunkan) writes: > > > (in-package :foo) ; cmucl likes a keyword here for some reason
> > Package names are strings, not symbols.
> Ok, that makes sense now. Come to think of it, CLHS says a package designator > is a string or a package---symbols are not included.
> Which also makes me wonder why symbols work at all.
The spec actually says a string *designator* or a package. "string designator" is also a defined term:
string designator n. a designator for a string; that is, an object that denotes a string and that is one of: a character (denoting a singleton string that has the character as its only element), a symbol (denoting the string that is its name), or a string (denoting itself). The intent is that this term be consistent with the behavior of string; implementations that extend string must extend the meaning of this term in a compatible way.
I'm very glad this piece of terminology is in there, because "string designator" is a useful concept.
> CLOCC code uses:
> (in-package :cllib)
> Even given that a symbol is accepted as a package designator, I still don't > understand why a keyword would also designate the same package, since :X and > X are different symbols.
Well, it's only being used for its SYMBOL-NAME.
-- /|_ .-----------------------. ,' .\ / | No to Imperialist war | ,--' _,' | Wage class war! | / / `-----------------------' ( -. | | ) | (`-. '--.) `. )----'
* Duane Rettig <du...@franz.com> | I'd be interested in seeing your solution.
I have some wrinkles to iron out and some real life testing to do, so the timing of Paul F. Dietz' comments were slightly infavorable. Franz Inc will be the first to know how about this, as you probably will be the only ones to seriously put it to the test, too. :)
| I have not had a chance to work on this (and have told Kent as much) | because I am deep into buttoning up our 6.2 version, which has been | essentially feature-frozen after beta release. But I am of course | interested in seeing a solution for the future (it would also be nice if | it were patchable).
It should be patchable for either image, but my primary goal has been to give you a very good reason not to distribute two different images, as it causes people to choose the lower-case image when all they want is some of the features that some of your programmers only think will "work" with in lower-case, and offer some fairly ridiculous arguments to the effect that it is "necessary". My goal has been to make it as easy to choose whether you see upper- or lower-case symbols as to set the readtable-case or the *print-case* variable.
/// -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief.
t...@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
...
> The spec actually says a string *designator* or a package. "string > designator" is also a defined term:
> string designator n. a designator for a string; that is, an object > that denotes a string and that is one of: a character (denoting a > singleton string that has the character as its only element), a > symbol (denoting the string that is its name), or a string (denoting > itself). The intent is that this term be consistent with the > behavior of string; implementations that extend string must extend > the meaning of this term in a compatible way.
> I'm very glad this piece of terminology is in there, because "string > designator" is a useful concept.
Heh. You should have seen the kind of junk that I was able to throw away due to the addition of this term. Phrases like
"a symbol or a string or a list of symbols or a list of strings"
were both more wordy AND incorrect (because they often omitted "a list of mixed symbols and strings") than the resulting:
"a designator for a list of string designators"
But the other important aspect of the change is that any phrase as textually compact as "a symbol or a string" still has an "or" in it, and that means any use of "or" to conjoin phrases or clauses in the sentence is arbitrarily harder to make work because you have to use ", or" or "; or" or you have to just give up and go to multiple sentences.
I almost couldn't NOT have introduced this terminology. I'm amazed Steele survived without it.
> > The :EXPORT clause takes an argument which is a string.
> Actually, a sequence of string designators.
> > Use
> > (defpackage "FOO" > > (:export "X"))
> > Don't be making symbols you don't mean to use.
> But this does the wrong thing if your lisp doesn't > by default read symbols as being in upper case.
Which happens to be the non standard way of doing things. ANSI requires that to be the default. If that is not the case, then you are consciously using a tweak of the reader.
> I prefer something like this:
> (defpackage :foo > (:export #:x))
> There was a long, drawn out thread about this last > year, wasn't there?
Yes. It was the CASE WARS thread. The problem is that the solution devised by Franz to fix the not-so-good (with the power of hindsight) decision to make CL case insensitive uppercasing, is not backward compatible.
Now. A backward compatible solution can be specified (shameless plug), but it requires agreement by the implementors to provide it.
The above style placates Franz case sensitive images, but it is arguably unpleasant and it is guaranteed to work well only in ACL. It does work in any CL, but, e.g. you do not have any guarantees that the uninterned symbols get collected.
Cheers
-- Marco Antoniotti ======================================================== NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488 719 Broadway 12th Floor fax +1 - 212 - 995 4122 New York, NY 10003, USA http://bioinformatics.cat.nyu.edu "Hello New York! We'll do what we can!" Bill Murray in `Ghostbusters'.
Marco Antoniotti <marc...@cs.nyu.edu> writes: > CASE FIGHT!!!!!!!!
Not at all.
> The above style placates Franz case sensitive images, but it is > arguably unpleasant and it is guaranteed to work well only in ACL. It > does work in any CL, but, e.g. you do not have any guarantees that the > uninterned symbols get collected.
I would hope that this would not be the situation. Uninterned symbols are not pointed to by any package, and thus tend to have similar characteristics as strings, wrt the number of references _to_ them. I.e. interned symbols will have an extra reference to them, from their home package, and it is usually this reference which keeps the symbol from being gc'd. However, uninterned symbols have no such reference to keep them from being gc'd.
So whatever the implementation, the form
(:export #:x)
would have similar nature wrt gc to
(:export "X")
since if the defpackage form does not let go of the #:x it would also not let go of the "X". Now, of course there is the possibility that the symbol x has not yet been created, and so "X" in the export list might be used for the symbol-name during the subsequent intern of x before its export. However, the possibility exists to use (symbol-name '#:x) in the same way. So the gc characteristics of the two specifications are the same, with the exception that the temporary allocation of #:x is larger than "X", if not optimized.
So in conclusion, I would hope that any defpackage implementation would allow its entries to be gc'd (modulo the interning usage I cited) whether it is an uninterned symbol or a string.
-- Duane Rettig Franz Inc. http://www.franz.com/ (www) 1995 University Ave Suite 275 Berkeley, CA 94704 Phone: (510) 548-3600; FAX: (510) 548-8253 du...@Franz.COM (internet)
i have, quite coincidentally, recently received a note from a lisp user who was confounded in his effort to use an application by problems with symbol name case. it was most amusing that, in keeping with the respective lisp vendor's documents on the subject, the enquiry was phrased in term of what one should do to make the application code 'portable'." i had always presumed that "portable" would be confined to runtime behaviour which itself conforms to "the standard".
the initial issue concerned symbol name case in code. i see some value to the "mixed case" style of capitalization, which can cause problems with some modes of case sensitivity. the lisp in question can be configured to accommodate mixed case style, so that is a minor issue.
beyond that, there are some cases where the upcased and literal cased symbols in the same package are assigned distinct meanings. this applies, for example, with function and/or class definitions generated from external, non-lisp definitions. in order for this to work, intern, defpackage, and read/print should all have readily predictable effects as to the internal and external representations of objects which they manipulate. i would have been less likely to use that method if it were not trivially possible to predict the internal symbol name case in a conforming lisp.
aside from my general curiosity about the possible advantages of permitting the programmer to predict the effects of thirty-six possible combinations of symbol case, readtable case, and print case, i am concerned whether everything which can be expressed in any given mode can also be expressed "portably". in particular, can everything which can be expressed in the mode which conforms to ansi behaviour also be expressed portably.
james anderson <james.ander...@setf.de> writes: > beyond that, there are some cases where the upcased and literal > cased symbols in the same package are assigned distinct > meanings. this applies, for example, with function and/or class > definitions generated from external, non-lisp definitions. in order > for this to work, intern, defpackage, and read/print should all have > readily predictable effects as to the internal and external > representations of objects which they manipulate. i would have been > less likely to use that method if it were not trivially possible to > predict the internal symbol name case in a conforming lisp.
As far as I know, there is no situation involving Common Lisp in which the internal symbol name case is not predictable. So I don't know what this means.
> aside from my general curiosity about the possible advantages of > permitting the programmer to predict the effects of thirty-six > possible combinations of symbol case, readtable case, and print > case,
There is no question that some of these combinations are more and less useful than others; but as far as I know, the utility of any given combination does not vary according to vendor platform. The language spec leaves vendors latitude about, for example, whether to quote a symbol name like \a\b or |ab| but not about whether to apply quoting at all. The language spec leaves no discretion about whether any given notation results in any given symbol name.
> i am concerned whether everything which can be expressed in any > given mode can also be expressed "portably".
If you set the printer/reader variables and readtable options the same, all should work the same in any _conforming_ implementation. If an implementation doesn't conform, you will get a problem.
> in particular, can everything which can be expressed in the mode > which conforms to ansi behaviour also be expressed portably.
The ANSI behavior is portable among vendors that conform to the ANSI spec. Your statement here supposes some other kind of portable.
> has there been any discussion on that question?
There has been a lot of frenzy about the fact that Franz offers two implementations: one attempts to be ANSI compliant and one (unfortunately badly named "modern") is apparently not trying to be ANSI compliant. (At some point in the future, there's some hope these will be unified, but for now not.) If you program in their non-ANSI version (or _anyone's_), your code will not be portable; that's what it means to be non-compliant--there is no promise that the standard will apply. If you stick to ANSI-compliant code and ANSI-compliant processors (i.e., implementations), your code should be portable, barring bugs in implementations. That's the whole point of a standard--it tells the user and vendor each must do in order that when the two come together, programs will work.
Note that if this is not about Franz Allegro, it's news to me, and you should say more. I don't know of another vendor that has elected this kind of deviation.
> > beyond that, there are some cases where the upcased and literal > > cased symbols in the same package are assigned distinct > > meanings. this applies, for example, with function and/or class > > definitions generated from external, non-lisp definitions. in order > > for this to work, intern, defpackage, and read/print should all have > > readily predictable effects as to the internal and external > > representations of objects which they manipulate. i would have been > > less likely to use that method if it were not trivially possible to > > predict the internal symbol name case in a conforming lisp.
> As far as I know, there is no situation involving Common Lisp in which > the internal symbol name case is not predictable. So I don't know > what this means.
i should have written that last clause as
"... less likely to use that method were it not trivially possible to predict the internal symbol name case in a conforming lisp."
with the addition of case modes, prediction is still possible, but it is no longer trivial. this aside from issues of conformance.
> > i am concerned whether everything which can be expressed in any > > given mode can also be expressed "portably".
> If you set the printer/reader variables and readtable options the > same, all should work the same in any _conforming_ implementation. If > an implementation doesn't conform, you will get a problem.
> > in particular, can everything which can be expressed in the mode > > which conforms to ansi behaviour also be expressed portably.
> The ANSI behavior is portable among vendors that conform to the ANSI > spec. Your statement here supposes some other kind of portable.
the ' " 's was were intended to indicate vendor terminology.
> > has there been any discussion on that question?
> There has been a lot of frenzy about the fact that Franz offers two > implementations: one attempts to be ANSI compliant and one > (unfortunately badly named "modern") is apparently not trying to be > ANSI compliant. (At some point in the future, there's some hope these > will be unified, but for now not.) If you program in their non-ANSI > version (or _anyone's_), your code will not be portable;
where the vendor's documentation addresses the problem, it describes several idioms for simple symbol manipulation which can serve to ensure that portable code (in the ansi sense) is also "portable" in the case mode sense. with little effort made to distinguish "case mode portable" from portable. which led to my question, as to whether there is always a "case mode portable" formulation for any given operation which is also portable in the ansi sense.
> that's what > it means to be non-compliant--there is no promise that the standard > will apply. If you stick to ANSI-compliant code and ANSI-compliant > processors (i.e., implementations), your code should be portable, > barring bugs in implementations. That's the whole point of a > standard--it tells the user and vendor each must do in order that when > the two come together, programs will work.
after reading their documentation, i came to the conclusion that coding "case mode portable" code portably would entail either a greater dependance on the reader than i would have wanted, or would require that one implement alternative symbol management routines which were sensitive to the non-conformant case modes when they were present. for the moment, i responded to the original party who was having problems, that some things would require a conformant lisp.
i was just wondering if there's more behind this.
> Note that if this is not about Franz Allegro, it's news to me, and you > should say more. I don't know of another vendor that has elected this > kind of deviation.
james anderson <james.ander...@setf.de> writes: > where the vendor's documentation addresses the problem, it describes > several idioms for simple symbol manipulation which can serve to ensure > that portable code (in the ansi sense) is also "portable" in the case > mode sense. with little effort made to distinguish "case mode portable" > from portable. which led to my question, as to whether there is always a > "case mode portable" formulation for any given operation which is also > portable in the ansi sense.
I have no idea. You don't say which vendor. You are working outside of the spec. As far as I'm concerned, you're on your own. You are asking for trouble, as far as I can see, and you have been given what you've asked for. This is not the intended programming style. There are good reasons the stnadard doesn't provide the functionality you want, and they are that it would lead to all kinds of portability problems that sound very similar to what you've gotten here. That is pretty much the end of the story as far as I'm concerned.
> > that's what > > it means to be non-compliant--there is no promise that the standard > > will apply. If you stick to ANSI-compliant code and ANSI-compliant > > processors (i.e., implementations), your code should be portable, > > barring bugs in implementations. That's the whole point of a > > standard--it tells the user and vendor each must do in order that when > > the two come together, programs will work.
> after reading their documentation, i came to the conclusion that coding > "case mode portable" code portably would entail either a greater > dependance on the reader than i would have wanted, or would require that > one implement alternative symbol management routines which were > sensitive to the non-conformant case modes when they were present. for > the moment, i responded to the original party who was having problems, > that some things would require a conformant lisp.
> i was just wondering if there's more behind this.
Yes, the "more" is that if you use a vendor product that does not follow the standard, then all bets are off as to what is compatible with what. That's why we have standards.
I can't personally feel any great sympathy for anyone who takes the bait and uses the vendor-specific option that says "I will make your life difficult if you use any vendor other than me" and then you find later that your life is difficult.
This is just not a difficult problem. SUGGESTION: JUST DON'T USE NON-PORTABLE STUFF.
There is simply no good programming need for non-portable naming. It is a contrived problem. If you use naming that doesn't interlock correctly with other programs, you may find that things don't interlock with other programs. Is this a surprise?
> > Note that if this is not about Franz Allegro, it's news to me, and you > > should say more. I don't know of another vendor that has elected this > > kind of deviation.
james anderson <james.ander...@setf.de> writes: > i have, quite coincidentally, recently received a note from a lisp user > who was confounded in his effort to use an application by problems with > symbol name case. it was most amusing that, in keeping with the > respective lisp vendor's documents on the subject, the enquiry was > phrased in term of what one should do to make the application code > 'portable'." i had always presumed that "portable" would be confined to > runtime behaviour which itself conforms to "the standard".
I am not sure what document you mean, nor what usage of the word "portable" you are using. There is an Ansi CL definition of portable, which in essence means "conforming", but there is also a more generic Computer Science definition of the word portable, and an even more generic dictionary definition of the term. My own World Book dictionary defines it as "capable of being carried or moved; easily carried".
I beleive that Franz's documentation tries to distinguish either by phrasology or by context whether we are talking about portability in the ANSI CL sense, or in the more generic sense. Where we talk about case portability, for example, we do not generate a link to the CL definition of portability. And we try to be specific about what kind of portability we are describing. For example, in
we say "If portability of your code between the various case modes is important, here are some things you should do"...
But also, we talk of portability for compatibility packages, like the older defforeign interface working with the newer def-foreign-call interface, or portability between Windows and Unix despite the different line-ending techniques they use.
None of the usages of the term are necesssarily mutually exclusive, and one can write a case-portable program which is also portable in the ANSI sense that it conforms to ANSI specs.
-- Duane Rettig Franz Inc. http://www.franz.com/ (www) 1995 University Ave Suite 275 Berkeley, CA 94704 Phone: (510) 548-3600; FAX: (510) 548-8253 du...@Franz.COM (internet)
> There has been a lot of frenzy about the fact that Franz offers two > implementations: [...] > If you program in their non-ANSI > version (or _anyone's_), your code will not be portable;
While I agreed with most of what you said, this statement is definitely not true. It is absolutely possible to write ANSI conforming programs in case-sensitive style which also happens to be case-portable (i.e. it works in both implementations). In such a case (pun intended :-) the program can be written to be both portable in the ANSI sense, and also portable in the case-sensitivity sense.
Of course, I am not arguing that it is impossible to write a case-sensitive program that is not ANSI compliant (e.g. with usage of the same words which vary only in case), but such a program is by definition not case-portable (i.e. it won't work in both case-sensitive-lower lisps and ANSI lisps). The documents we write about such case-portability are designed to show a programmer how to write in a style that will work in both implementations.
> Note that if this is not about Franz Allegro, it's news to me, and you > should say more. I don't know of another vendor that has elected this > kind of deviation.
I also made the assumption that the previous poster was talking about us.
-- Duane Rettig Franz Inc. http://www.franz.com/ (www) 1995 University Ave Suite 275 Berkeley, CA 94704 Phone: (510) 548-3600; FAX: (510) 548-8253 du...@Franz.COM (internet)
> > where the vendor's documentation addresses the problem, it describes > > several idioms for simple symbol manipulation which can serve to ensure > > that portable code (in the ansi sense) is also "portable" in the case > > mode sense. with little effort made to distinguish "case mode portable" > > from portable. which led to my question, as to whether there is always a > > "case mode portable" formulation for any given operation which is also > > portable in the ansi sense.
> I have no idea. You don't say which vendor.
I agree with this. Although we both assume that it is Franz.
> You are working outside of the spec.
You can't be sure of this. Mr. Anderson might not even be able to be sure of this, because he is posting on behalf of another, who should be contacting the vendor for support.
> As far as I'm concerned, you're on your own.
This is not true. Mr. Anderson (or his "original party") should contact the vendor for which they are having any problems.
-- Duane Rettig Franz Inc. http://www.franz.com/ (www) 1995 University Ave Suite 275 Berkeley, CA 94704 Phone: (510) 548-3600; FAX: (510) 548-8253 du...@Franz.COM (internet)