Giter VIP home page Giter VIP logo

Comments (2)

alexanderkiel avatar alexanderkiel commented on June 5, 2024

I use a multi method internally to register phrasers. What do you mean by "deleting a phraser"? Deleting a phrase is only possible by using remove-method on the multi method. Can you please post your REPL session?

But you are right, there should be a way to remove phrasers. There is already remove-default! which is not documented yet. I'll think about the best way to remove normal phrasers and phrasers with `:via.

from phrase.

leblowl avatar leblowl commented on June 5, 2024

I am referring to removing the method for a phraser, like you explain.

For example:

(defphraser pos-int?
  [_ _]
  "Please enter a positive integer.")

and

(defphraser pos-int?
  {:via [::year]}
  [_ _]
  "The year has to be a positive integer.")

are actually two entirely different phrasers. But in the REPL if you were to do something like this:

=> (defphraser pos-int?
       [_ _]
       "Please enter a positive integer.")
#multifn[phrase* 0x7ffa2c90]

=> (defphraser pos-int?
       {:via [::year]}
       [_ _]
       "The year has to be a positive integer.")
#multifn[phrase* 0x7ffa2c90]

The second pos-int? is always going to shadow the first pos-int? when phrasing problems for ::year. It is not clear how to remove a phraser. When evaluating expressions in the REPL directly, you can tell that the library uses a multi method, but when you evaluate a buffer/file (e.g. in Emacs with Cider) you don't get this information and so it's even more unclear in that case. Also, I'm not super familiar with multi methods but just knowing that you use a multi method for registering phrasers doesn't actually help me in removing a phraser's method - I would also need to know the dispatch value that you use for registering the method - is that correct? Thanks

from phrase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.