Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:48:44+00:00 2026-06-09T08:48:44+00:00

Consider this example: There is a class named ‘first’, which is defined in package

  • 0

Consider this example:

There is a class named ‘first’, which is defined in package ‘a’.

There is also a package ‘b’ which uses module ‘a’ functionalities.
Certain functions of package ‘b’ would require a object of class
‘first’ as a parameter. But besides this, there is no direct logical
link between package ‘a’ and ‘b’.

Now I wonder if it would be reasonable to write (defmethod package-b-function ((param first)) #|do stuff..|#) instead of a normal function, as the function needs the object and defining a method would clarify this for both the runtime environment and other users of package ‘b’.

I used to program in C++/Java therefore I am not familiar with the OOP conventions to be used in this case.

Appreciate your insight.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:48:47+00:00Added an answer on June 9, 2026 at 8:48 am

    Methods in Common Lisp don’t quite work the same way as the languages you note (see the appropriate two chapters of Practical Common Lisp for details). In a nutshell, at a very high level, you need to think about OO in lisp as “methods specialize on classes” rather than “classes have methods”.

    That said, yes, I think it would be perfectly reasonable for a package to have a method specializing on a class that’s defined elsewhere. Specifying the type of input you’re expecting clarifies intent for future readers (and may or may not help in optimization, but that’s not terribly important from my perspective). If you’re defining an ASDF system for your package, make sure to import the appropriate symbol, and depends-on the appropriate package.

    Just as a footnote, be aware that Common Lisp isn’t particularly object oriented as a language (for example, you’ll run into some odd corners if you decide that a particular class should have length, pop or push methods, or specialize on arithmetic operations).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this example: #include <iostream> class myclass { public: void print() { std::cout <<
Consider this simple example - public class Person { private String name; private Date
Consider this simple example (which displays in red): echo -e \033[31mHello World\033[0m It displays
Consider this example (typical in OOP books): I have an Animal class, where each
Consider a simple example like this which links two sliders using signals and slots:
Consider this example var task =Task.Factory.StartNew(()=>Console.WriteLine(test)); task.ContinueWith(antecendent => { ExceptionProcessor.HandleError(task.Exception.Flatten()); }, TaskContinuationOptions.OnlyOnFaulted); In this
Consider this example: zh_Hant_HK format = yy'年'M'月'd'日' ah:mm Not sure if you can see
Consider this example: l = [1, 2, 3, 4, 5] for values in l:
This is a follow-up question to this one . Consider this example: #include <iostream>
Consider this classic example used to explain what not to do with forward declarations:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.