Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delete-package #190

Merged
merged 3 commits into from
Jan 4, 2016
Merged

Add delete-package #190

merged 3 commits into from
Jan 4, 2016

Conversation

PuercoPop
Copy link
Member

Hi David,
This is a crude implementation of delete-package. It still has to handle exceptional situations like deleting a package used in another package.

From the changelog

  - Test that one can delete a package with package designators, such as
    a package, a string or symbol
  - Ensure that tests that create a package delete it before creating
    the package to avoid errors when attempting to create an existing
    package when running the test suite in succession.

Btw, should the bug about the incorrect typecase be added to the gh issue tracker?

  - Test that one can delete a package with package designators, such as
    a package, a string or symbol
  - Ensure that tests that create a package delete it before creating
    the package to avoid errors when attempting to create an existing
    package when running the test suite in succession.
@davazp
Copy link
Member

davazp commented Jan 4, 2016

I created an issue #192 for the etypecase thing.

@@ -28,6 +28,19 @@
package-designator
(oget *package-table* (string package-designator))))

(defun package-designator-package (package-designator)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some overlap between this function and find-package in package.lisp.

find-package uses string to convert the package-designator into a name, and then get the package. The only problem is that string is not signaling an error when it receives a non string designator, like a number.

If you use the typecase for string/symbol/character, so an error is signaled in string, then we can replace this function with just a call to find-package-or-fail.

  - Remove package-designator-package, use find-package instead.
  - Add TODO notes recording what is needed for a clhs compliant delete-package
@PuercoPop
Copy link
Member Author

Is this what you had in mind?

;; name a package.
;; TODO: Implement unuse-package and remove the deleted package from packages
;; that use it.
(delete-property (package-name (find-package package-designator))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be find-package-or-fail, right?

Also, string should fail if its argument is not a string designator. Now in JSCL (find-package 3) evaluates to NIL instead of signaling an error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, you are right! sec!

davazp added a commit that referenced this pull request Jan 4, 2016
@davazp davazp merged commit f080be5 into jscl-project:master Jan 4, 2016
@davazp
Copy link
Member

davazp commented Jan 4, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants